Skip to content

Commit 1585b1b

Browse files
Guo Zhengkuishuahkh
authored andcommitted
selftests/proc: fix array_size.cocci warning
Fix the following coccicheck warning: tools/testing/selftests/proc/proc-pid-vm.c:371:26-27: WARNING: Use ARRAY_SIZE tools/testing/selftests/proc/proc-pid-vm.c:420:26-27: WARNING: Use ARRAY_SIZE It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 8ff88be commit 1585b1b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tools/testing/selftests/proc/proc-pid-vm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <sys/time.h>
4747
#include <sys/resource.h>
4848

49+
#include "../kselftest.h"
50+
4951
static inline long sys_execveat(int dirfd, const char *pathname, char **argv, char **envp, int flags)
5052
{
5153
return syscall(SYS_execveat, dirfd, pathname, argv, envp, flags);
@@ -368,7 +370,7 @@ int main(void)
368370
};
369371
int i;
370372

371-
for (i = 0; i < sizeof(S)/sizeof(S[0]); i++) {
373+
for (i = 0; i < ARRAY_SIZE(S); i++) {
372374
assert(memmem(buf, rv, S[i], strlen(S[i])));
373375
}
374376

@@ -417,7 +419,7 @@ int main(void)
417419
};
418420
int i;
419421

420-
for (i = 0; i < sizeof(S)/sizeof(S[0]); i++) {
422+
for (i = 0; i < ARRAY_SIZE(S); i++) {
421423
assert(memmem(buf, rv, S[i], strlen(S[i])));
422424
}
423425
}

0 commit comments

Comments
 (0)