]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/x86/syscall: Fix coccinelle WARNING recommending the use of ARRAY_SIZE()
authorMirsad Todorovac <mtodorovac69@gmail.com>
Fri, 1 Nov 2024 11:15:23 +0000 (12:15 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 3 Mar 2025 11:38:49 +0000 (12:38 +0100)
Coccinelle gives WARNING recommending the use of ARRAY_SIZE() macro definition
to improve the code readability:

  ./tools/testing/selftests/x86/syscall_numbering.c:316:35-36: WARNING: Use ARRAY_SIZE

Fixes: 15c82d98a0f78 ("selftests/x86/syscall: Update and extend syscall_numbering_64")
Signed-off-by: Mirsad Todorovac <mtodorovac69@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/r/20241101111523.1293193-2-mtodorovac69@gmail.com
tools/testing/selftests/x86/syscall_numbering.c

index 991591718bb0aa26e5e760172984995cab7419a3..41c42b7b54a6c6f704e975b80661d0c3863e706f 100644 (file)
@@ -25,6 +25,7 @@
 #include <sys/mman.h>
 
 #include <linux/ptrace.h>
+#include "../kselftest.h"
 
 /* Common system call numbers */
 #define SYS_READ         0
@@ -313,7 +314,7 @@ static void test_syscall_numbering(void)
         * The MSB is supposed to be ignored, so we loop over a few
         * to test that out.
         */
-       for (size_t i = 0; i < sizeof(msbs)/sizeof(msbs[0]); i++) {
+       for (size_t i = 0; i < ARRAY_SIZE(msbs); i++) {
                int msb = msbs[i];
                run("Checking system calls with msb = %d (0x%x)\n",
                    msb, msb);