public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] samples/seccomp: fix array_size.cocci warning
@ 2022-11-13  9:58 wangkailong
  2022-11-13 15:52 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: wangkailong @ 2022-11-13  9:58 UTC (permalink / raw)
  To: linux-kernel, bpf

Fix following coccicheck warning:

samples/seccomp/bpf-fancy.c:83:39-40: WARNING: Use ARRAY_SIZE
samples/seccomp/bpf-fancy.c:86:44-45: WARNING: Use ARRAY_SIZE

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 samples/seccomp/bpf-fancy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/seccomp/bpf-fancy.c b/samples/seccomp/bpf-fancy.c
index 1ccb435025b6..548f038924d6 100644
--- a/samples/seccomp/bpf-fancy.c
+++ b/samples/seccomp/bpf-fancy.c
@@ -80,10 +80,10 @@ int main(int argc, char **argv)
 	};
 	struct sock_fprog prog = {
 		.filter = filter,
-		.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
+		.len = (unsigned short)(ARRAY_SIZE(filter)),
 	};
 	ssize_t bytes;
-	bpf_resolve_jumps(&l, filter, sizeof(filter)/sizeof(*filter));
+	bpf_resolve_jumps(&l, filter, ARRAY_SIZE(filter));
 
 	if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
 		perror("prctl(NO_NEW_PRIVS)");
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-22 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-13  9:58 [PATCH] samples/seccomp: fix array_size.cocci warning wangkailong
2022-11-13 15:52 ` kernel test robot
2022-11-14 17:15 ` sdf
2022-11-18  0:54   ` Kees Cook
2022-11-22 10:38 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox