From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 97EB95A026F for ; Thu, 21 Mar 2024 05:57:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1710997065; bh=Rb9PiCYODkN/llFoT+rOKCz8vef0zdTZWaVtwp1AltI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWWwka1FOnbgPFQob1B1ti8zJ9D5tGcb0v2Y+uGPj8JaRNpIT+8V18q+48+O60Vq2 KfhQCsHsvcms97gIeBhEsSxaq/LYiC305dnZaij39xfwYvtX9CeKFEptrJCyh9f+Fv cTxOPzBqYF8wdy9cyauw/kf0AuMWtn5gkeHm7T9mUlh7uHyzXvLiahR27bQCWHp8Xo iVK/lR+8kTCZzqbReRABH5HOsic1ifLA9FmK8IdtmvNPo3oT8+LMyOSqgqfrdg9wQI eJYgGGADlSu1uatla4I/W7GrQ5KKthAfUwUrvpjSAsTKXT2XBukg30PgV5JC3mxjLM 1tnYvTAPOYlEA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4V0Y9j0DNtz4wx6; Thu, 21 Mar 2024 15:57:45 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 1/5] cppcheck: Explicitly give files to check Date: Thu, 21 Mar 2024 15:57:38 +1100 Message-ID: <20240321045742.2267188-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240321045742.2267188-1-david@gibson.dropbear.id.au> References: <20240321045742.2267188-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: DH3W4NIKEUNCERN742466756SVNN42WR X-Message-ID-Hash: DH3W4NIKEUNCERN742466756SVNN42WR X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Paul Holzinger , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Currently "make cppcheck" invokes cppcheck on ".", so it will check all the .c and .h files it can find in the source tree. This isn't ideal, because it can find files that aren't actually part of the real build, or even stale files which aren't in git. More practically, some upcoming changes are looking at downloading other source trees for some tests. Static errors in there is Not Our Problem, so checking them is both slow and pointless. So, change the Makefile to invoke cppcheck only on the specific source files that are part of the build. For some reason in this format the badBitmaskCheck warnings in seccomp.h which were suppressed by 5beb3472e ("cppcheck: Avoid errors due to zeroes in bitwise ORs") no longer trigger. That means we get unmatchedSuppression warnings instead. We add an unmatchedSuppression suppression instead of simply removing the original suppressions, just in case this odd behaviour isn't the same for all cppcheck versions. Signed-off-by: David Gibson --- Makefile | 2 +- seccomp.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 84280520..c1e1f062 100644 --- a/Makefile +++ b/Makefile @@ -308,4 +308,4 @@ cppcheck: $(SRCS) $(HEADERS) --inline-suppr \ --suppress=unusedStructMember \ $(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ - . + $(SRCS) $(HEADERS) diff --git a/seccomp.sh b/seccomp.sh index e1224e0d..052e1c8c 100755 --- a/seccomp.sh +++ b/seccomp.sh @@ -29,11 +29,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 */ + /* cppcheck-suppress [badBitmaskCheck, unmatchedSuppression] */ 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 */ + /* cppcheck-suppress [badBitmaskCheck, unmatchedSuppression] */ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))), -- 2.44.0