aboutgitcodebugslistschat
path: root/seccomp.sh
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:34 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:22:37 +0200
commit5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8 (patch)
tree2800a5f9eaddc3c7b9e667bf635d91c449ba6112 /seccomp.sh
parent0616620805370f334eb8ccf7fc6e03e822d8deab (diff)
downloadpasst-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar.gz
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar.bz2
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar.lz
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar.xz
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.tar.zst
passt-5beb3472ed4cf92be1fe1f27668dc0f1284bb2a8.zip
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'seccomp.sh')
-rwxr-xr-xseccomp.sh2
1 files changed, 2 insertions, 0 deletions
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))),