From 5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 28 Sep 2022 14:33:34 +1000 Subject: cppcheck: Avoid errors due to zeroes in bitwise ORs Recent versions of cppcheck give warnings if using a bitwise OR (|) where some of the arguments are zero. We're triggering these warnings in our generated seccomp.h header, because BPF_LD and BPF_W are zero-valued. However putting these defines in makes the generate code clearer, even though they could be left out without changing the values. So, add cppcheck suppressions to the generated code. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- seccomp.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/seccomp.sh b/seccomp.sh index 17def4d..31ea8da 100755 --- a/seccomp.sh +++ b/seccomp.sh @@ -26,9 +26,11 @@ HEADER="/* This file was automatically generated by $(basename ${0}) */ # Prefix for each profile: check that 'arch' in seccomp_data is matching PRE=' struct sock_filter filter_@PROFILE@[] = { + /* cppcheck-suppress badBitmaskCheck */ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, arch))), BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, PASST_AUDIT_ARCH, 0, @KILL@), + /* cppcheck-suppress badBitmaskCheck */ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))), -- cgit v1.2.3