lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240424204419.98942-1-adilger@dilger.ca>
Date: Wed, 24 Apr 2024 14:44:19 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Andy Whitcroft <apw@...onical.com>
Cc: Joe Perches <joe@...ches.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andreas Dilger <adilger@...ger.ca>
Subject: [PATCH v2 RESEND] checkpatch: ignore deleted lines for comment context

Don't consider lines being removed by a patch as part of the context.
Otherwise, false "WARNING: memory barrier without comment" and similar
warnings can be reported when a comment exists on the previous line.

For example, a change like below was previously incorrectly flagged
as not having a comment because ctx_locate_comment() considers the
modified '-' line not to be a comment:

	/* matched by smp_store_release() in some_function() */
 -	if (smp_load_acquire(&list->tail) == head))
 +	if (smp_load_acquire(&list->tail) == head) && flags == 0)

Signed-off-by: Andreas Dilger <adilger@...ger.ca>
---
v1->v2: don't update the #warn line

 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c4c4a61bc83..80691e3e3ef2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1974,6 +1974,7 @@ sub ctx_locate_comment {
 	for (my $linenr = $first_line; $linenr < $end_line; $linenr++) {
 		my $line = $rawlines[$linenr - 1];
 		#warn "           $line\n";
+		next if ($line =~ /^-/); # ignore lines removed by patch
 		if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
 			$in_comment = 1;
 		}
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ