aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/vDSO
diff options
context:
space:
mode:
authorGuo Zhengkui <guozhengkui@vivo.com>2022-03-21 13:27:42 +0800
committerShuah Khan <skhan@linuxfoundation.org>2022-04-04 13:27:11 -0600
commit8ff88bec6f6186c406aa71312b2919e56f7b8084 (patch)
treefde160184795d85563f7d2cf776d4755cce1f0c6 /tools/testing/selftests/vDSO
parentLinux 5.18-rc1 (diff)
downloadlinux-dev-8ff88bec6f6186c406aa71312b2919e56f7b8084.tar.xz
linux-dev-8ff88bec6f6186c406aa71312b2919e56f7b8084.zip
selftests/vDSO: fix array_size.cocci warning
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 <guozhengkui@vivo.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/vDSO')
-rw-r--r--tools/testing/selftests/vDSO/vdso_test_correctness.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index c4aea794725a..e691a3cf1491 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -20,6 +20,7 @@
#include <limits.h>
#include "vdso_config.h"
+#include "../kselftest.h"
static const char **name;
@@ -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");
@@ -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");