Skip to content

Commit 26347f8

Browse files
Zhang Chujunshuahkh
authored andcommitted
selftests/dma: fix invalid array access in printf
The printf statement attempts to print the DMA direction string using the syntax 'dir[directions]', which is an invalid array access. The variable 'dir' is an integer, and 'directions' is a char pointer array. This incorrect syntax should be 'directions[dir]', using 'dir' as the index into the 'directions' array. Fix this by correcting the array access from 'dir[directions]' to 'directions[dir]'. Link: https://lore.kernel.org/r/20251104025234.2363-1-zhangchujun@cmss.chinamobile.com Signed-off-by: Zhang Chujun <zhangchujun@cmss.chinamobile.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 37f4660 commit 26347f8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/testing/selftests/dma/dma_map_benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
118118
}
119119

120120
printf("dma mapping benchmark: threads:%d seconds:%d node:%d dir:%s granule: %d\n",
121-
threads, seconds, node, dir[directions], granule);
121+
threads, seconds, node, directions[dir], granule);
122122
printf("average map latency(us):%.1f standard deviation:%.1f\n",
123123
map.avg_map_100ns/10.0, map.map_stddev/10.0);
124124
printf("average unmap latency(us):%.1f standard deviation:%.1f\n",

0 commit comments

Comments
 (0)