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>
This commit is contained in:
parent
0616620805
commit
5beb3472ed
1 changed files with 2 additions and 0 deletions
|
@ -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
|
# Prefix for each profile: check that 'arch' in seccomp_data is matching
|
||||||
PRE='
|
PRE='
|
||||||
struct sock_filter filter_@PROFILE@[] = {
|
struct sock_filter filter_@PROFILE@[] = {
|
||||||
|
/* cppcheck-suppress badBitmaskCheck */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, arch))),
|
(offsetof(struct seccomp_data, arch))),
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, PASST_AUDIT_ARCH, 0, @KILL@),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, PASST_AUDIT_ARCH, 0, @KILL@),
|
||||||
|
/* cppcheck-suppress badBitmaskCheck */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, nr))),
|
(offsetof(struct seccomp_data, nr))),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue