Skip to contentSkip to conversation

selftests/x86/syscall: use ARRAY_SIZE for msbs

PATCH Superseded Jiapeng Chong 1 participant 1 message Jun 9, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/x86/syscall: use ARRAY_SIZE for msbs

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.

Clean up the following coccicheck warning:

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

---
 tools/testing/selftests/x86/syscall_numbering.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/x86/syscall_numbering.c +1 -1
index 9915917..7d5e246 100644
@@ -313,7 +313,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
1.8.3.1