selftests/x86/syscall: fix coccinelle WARNING recommending the use of ARRAY_SIZE()
Subsystems (5)
PATCH 1/2 selftests/x86/syscall: fix coccinelle WARNING recommending the use of ARRAY_SIZE()
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
---
v1: initial version.
tools/testing/selftests/x86/syscall_numbering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/syscall_numbering.c +2 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 2/2 selftests/mm: fix coccinelle WARNING recommending the use of ARRAY_SIZE()
Coccinelle gives WARNING recommending the use of ARRAY_SIZE() macro definition to improve the code readability:
./tools/testing/selftests/mm/uffd-unit-tests.c:1484:32-33: WARNING: Use ARRAY_SIZE ./tools/testing/selftests/mm/uffd-unit-tests.c:1485:30-31: WARNING: Use ARRAY_SIZE
---
v1: initial version.
tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/mm/uffd-unit-tests.c +2 -2
@@ -1481,8 +1481,8 @@ static void usage(const char *prog)int main (int argc,char *argv[]) { -int n_tests =sizeof (uffd_tests) /sizeof (uffd_test_case_t); -int n_mems =sizeof (mem_types) /sizeof (mem_type_t); +int n_tests =ARRAY_SIZE (uffd_tests); +int n_mems =ARRAY_SIZE (mem_types);const char *test_filter =NULL ;bool list_only = false;uffd_test_case_t *test;
Signature · 1 line
2.43.0
Re: [PATCH v1 2/2] selftests/mm: fix coccinelle WARNING recommending the use of ARRAY_SIZE()
Quoted 6 lines · Mirsad Todorovac
Coccinelle gives WARNING recommending the use of
ARRAY_SIZE()macro definition to improve the code readability:./tools/testing/selftests/mm/uffd-unit-tests.c:1484:32-33: WARNING: Use
ARRAY_SIZE./tools/testing/selftests/mm/uffd-unit-tests.c:1485:30-31: WARNING: UseARRAY_SIZE
Quoted 8 lines
Fixes 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test")Cc Andrew Morton <[email protected]>Cc Shuah Khan <[email protected]>Cc Peter Xu <[email protected]>Signed-off-by Mirsad Todorovac <[email protected]>
Signature · 1 line
Peter Xu
Re: [PATCH v1 2/2] selftests/mm: fix coccinelle WARNING recommending the use of ARRAY_SIZE()
Quoted 16 lines · Peter Xu
Quoted 6 lines · Mirsad Todorovac
Coccinelle gives WARNING recommending the use of
ARRAY_SIZE()macro definition to improve the code readability:./tools/testing/selftests/mm/uffd-unit-tests.c:1484:32-33: WARNING: Use
ARRAY_SIZE./tools/testing/selftests/mm/uffd-unit-tests.c:1485:30-31: WARNING: UseARRAY_SIZEQuoted 8 lines
Fixes 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test")Cc Andrew Morton <[email protected]>Cc Shuah Khan <[email protected]>Cc Peter Xu <[email protected]>Signed-off-by Mirsad Todorovac <[email protected]>
Quoted 1 line
Acked-by Peter Xu <[email protected]>
Thanks for the quick review.
Best regards,
Mirsad
Quoted 5 lines · Mirsad Todorovac
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
Quoted 11 lines
Fixes 15c82d98a0f78 ("selftests/x86/syscall: Update and extend syscall_numbering_64")Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Shuah Khan <[email protected]>Signed-off-by Mirsad Todorovac <[email protected]>
Quoted 27 lines
---
v1: initial version.tools/testing/selftests/x86/syscall_numbering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/x86/syscall_numbering.c +2
-1@@ -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);
Signature · 2 lines
BR, Muhammad Usama Anjum
Quoted 18 lines · Muhammad Usama Anjum
Quoted 5 lines · Mirsad Todorovac
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_SIZEQuoted 11 lines
Fixes 15c82d98a0f78 ("selftests/x86/syscall: Update and extend syscall_numbering_64")Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Shuah Khan <[email protected]>Signed-off-by Mirsad Todorovac <[email protected]>
Quoted 1 line
Reviewed-by Muhammad Usama Anjum <[email protected]>
Dear Sir,
Thank you for your positive review of the patch.
There are much more suggestions by the coccinelle check, but that's a substantial work to do.
It would help to set some priorities in this by some more experienced developer.
Thank you.
Best regards,
Mirsad Todorovac
Quoted 28 lines
Quoted 27 lines
---
v1: initial version.tools/testing/selftests/x86/syscall_numbering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/x86/syscall_numbering.c +2
-1@@ -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);
[tip: x86/cleanups] selftests/x86/syscall: Fix coccinelle WARNING recommending the use of ARRAY_SIZE()
In reply to Mirsad TodorovacThe following commit has been merged into the x86/cleanups branch of tip:
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 40fc7561013914ec08c200bb7a0805643a23e070 Gitweb: https://git.kernel.org/tip/40fc7561013914ec08c200bb7a0805643a23e070 Author: Mirsad Todorovac <[email protected]> AuthorDate: Fri, 01 Nov 2024 12:15:23 +01:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Mon, 03 Mar 2025 12:38:49 +01:00
selftests/x86/syscall: Fix coccinelle WARNING recommending the use of ARRAY_SIZE()
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
--- tools/testing/selftests/x86/syscall_numbering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/syscall_numbering.c +2 -1
@@ -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);