[PATCH] selftests/dma: Fix bad array reference.

Liu Ye posted 1 patch 10 months, 1 week ago
tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] selftests/dma: Fix bad array reference.
Posted by Liu Ye 10 months, 1 week ago
dir[directions] should be directions[dir] to correctly index the
directions array.

Signed-off-by: Liu Ye <liuye@kylinos.cn>
---
 tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
index b12f1f9babf8..b925756373ce 100644
--- a/tools/testing/selftests/dma/dma_map_benchmark.c
+++ b/tools/testing/selftests/dma/dma_map_benchmark.c
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
 	}
 
 	printf("dma mapping benchmark: threads:%d seconds:%d node:%d dir:%s granule: %d\n",
-			threads, seconds, node, dir[directions], granule);
+			threads, seconds, node, directions[dir], granule);
 	printf("average map latency(us):%.1f standard deviation:%.1f\n",
 			map.avg_map_100ns/10.0, map.map_stddev/10.0);
 	printf("average unmap latency(us):%.1f standard deviation:%.1f\n",
-- 
2.25.1
Re: [PATCH] selftests/dma: Fix bad array reference.
Posted by liuye 9 months, 3 weeks ago
Friendly ping.

在 2025/2/6 10:12, Liu Ye 写道:
> dir[directions] should be directions[dir] to correctly index the
> directions array.
>
> Signed-off-by: Liu Ye <liuye@kylinos.cn>
> ---
>  tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
> index b12f1f9babf8..b925756373ce 100644
> --- a/tools/testing/selftests/dma/dma_map_benchmark.c
> +++ b/tools/testing/selftests/dma/dma_map_benchmark.c
> @@ -118,7 +118,7 @@ int main(int argc, char **argv)
>  	}
>  
>  	printf("dma mapping benchmark: threads:%d seconds:%d node:%d dir:%s granule: %d\n",
> -			threads, seconds, node, dir[directions], granule);
> +			threads, seconds, node, directions[dir], granule);
>  	printf("average map latency(us):%.1f standard deviation:%.1f\n",
>  			map.avg_map_100ns/10.0, map.map_stddev/10.0);
>  	printf("average unmap latency(us):%.1f standard deviation:%.1f\n",
Re: [PATCH] selftests/dma: Fix bad array reference.
Posted by Shuah Khan 9 months, 2 weeks ago
On 2/25/25 18:31, liuye wrote:
> Friendly ping.
> 
> 在 2025/2/6 10:12, Liu Ye 写道:
>> dir[directions] should be directions[dir] to correctly index the
>> directions array.
>>
>> Signed-off-by: Liu Ye <liuye@kylinos.cn>
>> ---
>>   tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
>> index b12f1f9babf8..b925756373ce 100644
>> --- a/tools/testing/selftests/dma/dma_map_benchmark.c
>> +++ b/tools/testing/selftests/dma/dma_map_benchmark.c
>> @@ -118,7 +118,7 @@ int main(int argc, char **argv)
>>   	}
>>   
>>   	printf("dma mapping benchmark: threads:%d seconds:%d node:%d dir:%s granule: %d\n",
>> -			threads, seconds, node, dir[directions], granule);
>> +			threads, seconds, node, directions[dir], granule);
>>   	printf("average map latency(us):%.1f standard deviation:%.1f\n",
>>   			map.avg_map_100ns/10.0, map.map_stddev/10.0);
>>   	printf("average unmap latency(us):%.1f standard deviation:%.1f\n",

How did you find this problem?

thanks,
-- Shuah


Re: [PATCH] selftests/dma: Fix bad array reference.
Posted by liuye 9 months, 2 weeks ago
By code observation only.

Thanks,
Liu Ye

在 2025/2/27 05:41, Shuah Khan 写道:
> On 2/25/25 18:31, liuye wrote:
>> Friendly ping.
>>
>> 在 2025/2/6 10:12, Liu Ye 写道:
>>> dir[directions] should be directions[dir] to correctly index the
>>> directions array.
>>>
>>> Signed-off-by: Liu Ye <liuye@kylinos.cn>
>>> ---
>>>   tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
>>> index b12f1f9babf8..b925756373ce 100644
>>> --- a/tools/testing/selftests/dma/dma_map_benchmark.c
>>> +++ b/tools/testing/selftests/dma/dma_map_benchmark.c
>>> @@ -118,7 +118,7 @@ int main(int argc, char **argv)
>>>       }
>>>         printf("dma mapping benchmark: threads:%d seconds:%d node:%d dir:%s granule: %d\n",
>>> -            threads, seconds, node, dir[directions], granule);
>>> +            threads, seconds, node, directions[dir], granule);
>>>       printf("average map latency(us):%.1f standard deviation:%.1f\n",
>>>               map.avg_map_100ns/10.0, map.map_stddev/10.0);
>>>       printf("average unmap latency(us):%.1f standard deviation:%.1f\n",
>
> How did you find this problem?
>
> thanks,
> -- Shuah
>
>