[PATCH] um: use ARRAY_SIZE macro in stub_exe.c

longlong yan posted 1 patch 1 week, 1 day ago
arch/um/kernel/skas/stub_exe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] um: use ARRAY_SIZE macro in stub_exe.c
Posted by longlong yan 1 week, 1 day ago
The ARRAY_SIZE macro is more compact and more formal in linux source.

Fixes: 406d17c6c370 ("um: Implement kernel side of SECCOMP based process handling")
Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
---
 arch/um/kernel/skas/stub_exe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/um/kernel/skas/stub_exe.c b/arch/um/kernel/skas/stub_exe.c
index cbafaa684e66..2b89acbcbad8 100644
--- a/arch/um/kernel/skas/stub_exe.c
+++ b/arch/um/kernel/skas/stub_exe.c
@@ -7,6 +7,7 @@
 #include <linux/filter.h>
 #include <linux/seccomp.h>
 #include <generated/asm-offsets.h>
+#include <shared/user.h>
 
 void _start(void);
 
@@ -193,7 +194,7 @@ noinline static void real_init(void)
 			BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
 		};
 		struct sock_fprog prog = {
-			.len = sizeof(filter) / sizeof(filter[0]),
+			.len = ARRAY_SIZE(filter),
 			.filter = filter,
 		};
 
-- 
2.43.0