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>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 21 Sep 2014 20:32:24 -0500
From:	Greg Donald <gdonald@...il.com>
To:	Joe Perches <joe@...ches.com>, Andy Whitcroft <apw@...onical.com>,
	linux-kernel@...r.kernel.org
Cc:	Greg Donald <gdonald@...il.com>
Subject: [PATCH] scripts: checkpatch.pl: Fix existing typedef false positive warning

Fixing an "open brace '{' following struct go on the same line" error causes a
false positive warning "do not add new typedefs". Fix existing typedef false
positive warning.

Signed-off-by: Greg Donald <gdonald@...il.com>
---
 scripts/checkpatch.pl | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4d08b39..eafe5e7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3081,14 +3081,24 @@ sub process {
 		}
 
 # check for new typedefs, only function parameters and sparse annotations
-# make sense.
+# and existing typedefs make sense.
 		if ($line =~ /\btypedef\s/ &&
 		    $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
 		    $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
 		    $line !~ /\b$typeTypedefs\b/ &&
 		    $line !~ /\b__bitwise(?:__|)\b/) {
-			WARN("NEW_TYPEDEFS",
-			     "do not add new typedefs\n" . $herecurr);
+			# check if $line is diff-like
+			if (substr($rawlines[$linenr - 3], 0, 1) eq '-') {
+				my $oldline3 = substr($rawlines[$linenr - 3], 1);
+				# check if typedef already existed
+				if ($line !~ /$oldline3/) {
+					WARN("NEW_TYPEDEFS",
+					     "do not add new typedefs\n" . $herecurr);
+				}
+			} else {
+				WARN("NEW_TYPEDEFS",
+				     "do not add new typedefs\n" . $herecurr);
+			}
 		}
 
 # * goes on variable not on type
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ