Skip to content

Commit f82efe5

Browse files
Guo Zhengkuictmarinas
authored andcommitted
kselftest/arm64: fix array_size.cocci warning
Fix the following coccicheck warnings: tools/testing/selftests/arm64/mte/check_child_memory.c:110:25-26: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_child_memory.c:88:24-25: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_child_memory.c:90:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_child_memory.c:147:24-25: WARNING: Use ARRAY_SIZE `ARRAY_SIZE` macro is defined in tools/testing/selftests/kselftest.h. Signed-off-by: Guo Zhengkui <[email protected]> Reviewed-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 212b042 commit f82efe5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ static int check_child_memory_mapping(int mem_type, int mode, int mapping)
8585
{
8686
char *ptr;
8787
int run, result;
88-
int item = sizeof(sizes)/sizeof(int);
88+
int item = ARRAY_SIZE(sizes);
8989

90-
item = sizeof(sizes)/sizeof(int);
90+
item = ARRAY_SIZE(sizes);
9191
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
9292
for (run = 0; run < item; run++) {
9393
ptr = (char *)mte_allocate_memory_tag_range(sizes[run], mem_type, mapping,
@@ -107,7 +107,7 @@ static int check_child_file_mapping(int mem_type, int mode, int mapping)
107107
{
108108
char *ptr, *map_ptr;
109109
int run, fd, map_size, result = KSFT_PASS;
110-
int total = sizeof(sizes)/sizeof(int);
110+
int total = ARRAY_SIZE(sizes);
111111

112112
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
113113
for (run = 0; run < total; run++) {
@@ -144,7 +144,7 @@ static int check_child_file_mapping(int mem_type, int mode, int mapping)
144144
int main(int argc, char *argv[])
145145
{
146146
int err;
147-
int item = sizeof(sizes)/sizeof(int);
147+
int item = ARRAY_SIZE(sizes);
148148

149149
page_size = getpagesize();
150150
if (!page_size) {

0 commit comments

Comments
 (0)