summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/proc
diff options
context:
space:
mode:
authorGuo Zhengkui <guozhengkui@vivo.com>2022-03-21 11:25:17 +0100
committerShuah Khan <skhan@linuxfoundation.org>2022-04-04 21:27:21 +0200
commit1585b1b55a2b9086823a6b30031eb63f965f8d44 (patch)
treeb1b92d844133d054d506b2f7e3a3cc0fe56da86e /tools/testing/selftests/proc
parentselftests/vDSO: fix array_size.cocci warning (diff)
downloadlinux-1585b1b55a2b9086823a6b30031eb63f965f8d44.tar.xz
linux-1585b1b55a2b9086823a6b30031eb63f965f8d44.zip
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>
Diffstat (limited to 'tools/testing/selftests/proc')
-rw-r--r--tools/testing/selftests/proc/proc-pid-vm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c
index 18a3bde8bc96..28604c9f805c 100644
--- a/tools/testing/selftests/proc/proc-pid-vm.c
+++ b/tools/testing/selftests/proc/proc-pid-vm.c
@@ -46,6 +46,8 @@
#include <sys/time.h>
#include <sys/resource.h>
+#include "../kselftest.h"
+
static inline long sys_execveat(int dirfd, const char *pathname, char **argv, char **envp, int flags)
{
return syscall(SYS_execveat, dirfd, pathname, argv, envp, flags);
@@ -368,7 +370,7 @@ int main(void)
};
int i;
- for (i = 0; i < sizeof(S)/sizeof(S[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(S); i++) {
assert(memmem(buf, rv, S[i], strlen(S[i])));
}
@@ -417,7 +419,7 @@ int main(void)
};
int i;
- for (i = 0; i < sizeof(S)/sizeof(S[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(S); i++) {
assert(memmem(buf, rv, S[i], strlen(S[i])));
}
}