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:   Tue, 10 Jul 2018 10:42:04 -0700
From:   Prakruthi Deepak Heragu <pheragu@...eaurora.org>
To:     apw@...onical.com, joe@...ches.com
Cc:     linux-kernel@...r.kernel.org, tsoni@...eaurora.org,
        ckadabi@...eaurora.org, bryanh@...eaurora.org,
        Prakruthi Deepak Heragu <pheragu@...eaurora.org>
Subject: [PATCH] checkpatch: Handle long multi-line macros better

Currently, the checkpatch throws an error on long macro expressions which
is more than one line i.e the opening and the closing bracket pair not
being on the same line. This patch gives the dangling backslash the
benefit of doubt and allows it to consider the closing paranthesis on the
next line as part of the macro expression and doesn't throw an error.

Signed-off-by: Prakruthi Deepak Heragu <pheragu@...eaurora.org>
---
 scripts/checkpatch.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 599ae61..158c96d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5038,7 +5038,7 @@ sub process {
 		if ($realfile !~ m@...linux.lds.h$@ &&
 		    $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
 			my $ln = $linenr;
-			my $cnt = $realcnt;
+			my $cnt = $realcnt - 1;
 			my ($off, $dstat, $dcond, $rest);
 			my $ctx = '';
 			my $has_flow_statement = 0;
@@ -5075,6 +5075,11 @@ sub process {
 			{
 			}
 
+			# Extremely long macros may fall off the end of the
+			# available context without closing.  Give a dangling
+			# backslash the benefit of the doubt and allow it
+			# to gobble any hanging close-parens.
+			$dstat =~ s/\(.+\\$/1/;
 			# Flatten any obvious string concatentation.
 			while ($dstat =~ s/($String)\s*$Ident/$1/ ||
 			       $dstat =~ s/$Ident\s*($String)/$1/)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ