Skip to content

Commit

Permalink
selftests/vDSO: fix array_size.cocci warning
Browse files Browse the repository at this point in the history
Fix the following coccicheck warning:

tools/testing/selftests/vDSO/vdso_test_correctness.c:309:46-47:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/vDSO/vdso_test_correctness.c:373:46-47:
WARNING: Use ARRAY_SIZE

It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64.

Signed-off-by: Guo Zhengkui <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
Guo Zhengkui authored and shuahkh committed Apr 4, 2022
1 parent 3123109 commit 8ff88be
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tools/testing/selftests/vDSO/vdso_test_correctness.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <limits.h>

#include "vdso_config.h"
#include "../kselftest.h"

static const char **name;

Expand Down Expand Up @@ -306,10 +307,8 @@ static void test_clock_gettime(void)
return;
}

for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
clock++) {
for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
test_one_clock_gettime(clock, clocknames[clock]);
}

/* Also test some invalid clock ids */
test_one_clock_gettime(-1, "invalid");
Expand Down Expand Up @@ -370,10 +369,8 @@ static void test_clock_gettime64(void)
return;
}

for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
clock++) {
for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
test_one_clock_gettime64(clock, clocknames[clock]);
}

/* Also test some invalid clock ids */
test_one_clock_gettime64(-1, "invalid");
Expand Down

0 comments on commit 8ff88be

Please sign in to comment.