Skip to content

Commit a75df5b

Browse files
wangkailong@jari.cnwilldeacon
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent a0fa0b6 commit a75df5b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/testing/selftests/arm64/mte/check_mmap_options.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ static int check_anonymous_memory_mapping(int mem_type, int mode, int mapping, i
6161
{
6262
char *ptr, *map_ptr;
6363
int run, result, map_size;
64-
int item = sizeof(sizes)/sizeof(int);
64+
int item = ARRAY_SIZE(sizes);
6565

66-
item = sizeof(sizes)/sizeof(int);
6766
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
6867
for (run = 0; run < item; run++) {
6968
map_size = sizes[run] + OVERFLOW + UNDERFLOW;
@@ -93,7 +92,7 @@ static int check_file_memory_mapping(int mem_type, int mode, int mapping, int ta
9392
{
9493
char *ptr, *map_ptr;
9594
int run, fd, map_size;
96-
int total = sizeof(sizes)/sizeof(int);
95+
int total = ARRAY_SIZE(sizes);
9796
int result = KSFT_PASS;
9897

9998
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
@@ -132,7 +131,7 @@ static int check_clear_prot_mte_flag(int mem_type, int mode, int mapping)
132131
{
133132
char *ptr, *map_ptr;
134133
int run, prot_flag, result, fd, map_size;
135-
int total = sizeof(sizes)/sizeof(int);
134+
int total = ARRAY_SIZE(sizes);
136135

137136
prot_flag = PROT_READ | PROT_WRITE;
138137
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
@@ -187,7 +186,7 @@ static int check_clear_prot_mte_flag(int mem_type, int mode, int mapping)
187186
int main(int argc, char *argv[])
188187
{
189188
int err;
190-
int item = sizeof(sizes)/sizeof(int);
189+
int item = ARRAY_SIZE(sizes);
191190

192191
err = mte_default_setup();
193192
if (err)

0 commit comments

Comments
 (0)