Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kselftest/arm64: fix array_size.cocci warning

Fix following coccicheck warning:

tools/testing/selftests/arm64/mte/check_mmap_options.c:64:24-25:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/arm64/mte/check_mmap_options.c:66:20-21:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/arm64/mte/check_mmap_options.c:135:25-26:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/arm64/mte/check_mmap_options.c:96:25-26:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/arm64/mte/check_mmap_options.c:190:24-25:
WARNING: Use ARRAY_SIZE

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
Link: https://lore.kernel.org/r/777ce8ba.12e.184705d4211.Coremail.wangkailong@jari.cn
Signed-off-by: Will Deacon <will@kernel.org>

authored by

wangkailong@jari.cn and committed by
Will Deacon
a75df5be a0fa0b63

+4 -5
+4 -5
tools/testing/selftests/arm64/mte/check_mmap_options.c
··· 61 61 { 62 62 char *ptr, *map_ptr; 63 63 int run, result, map_size; 64 - int item = sizeof(sizes)/sizeof(int); 64 + int item = ARRAY_SIZE(sizes); 65 65 66 - item = sizeof(sizes)/sizeof(int); 67 66 mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); 68 67 for (run = 0; run < item; run++) { 69 68 map_size = sizes[run] + OVERFLOW + UNDERFLOW; ··· 92 93 { 93 94 char *ptr, *map_ptr; 94 95 int run, fd, map_size; 95 - int total = sizeof(sizes)/sizeof(int); 96 + int total = ARRAY_SIZE(sizes); 96 97 int result = KSFT_PASS; 97 98 98 99 mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); ··· 131 132 { 132 133 char *ptr, *map_ptr; 133 134 int run, prot_flag, result, fd, map_size; 134 - int total = sizeof(sizes)/sizeof(int); 135 + int total = ARRAY_SIZE(sizes); 135 136 136 137 prot_flag = PROT_READ | PROT_WRITE; 137 138 mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); ··· 186 187 int main(int argc, char *argv[]) 187 188 { 188 189 int err; 189 - int item = sizeof(sizes)/sizeof(int); 190 + int item = ARRAY_SIZE(sizes); 190 191 191 192 err = mte_default_setup(); 192 193 if (err)