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:	Mon, 14 Oct 2013 10:32:08 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	linux-kernel@...r.kernel.org
Cc:	Nandini Hanumanthagowda <nandu.hgowda@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andy Whitcroft <apw@...onical.com>,
	Joe Perches <joe@...ches.com>
Subject: [PATCH] checkpatch: Allow spaces before the ':' of a bitfield

checkpatch warns about spaces both before and after the ':' separating a
bitfield name from its width.  However, many drivers do put space before
the : to line up the widths, which makes the definition significantly
more readable; checkpatch should not warn about that.  Remove the
warning for space before the ':' of a bitfield.

Reported-by: Nandini Hanumanthagowda <nandu.hgowda@...il.com>
Reported-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Josh Triplett <josh@...htriplett.org>
---

Nandini and Greg observed this issue as part of checkpatch warnings on a
staging driver (octeon-usb), and both agreed that checkpatch should not
issue this warning; patching accordingly.

 scripts/checkpatch.pl | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ed16a68..9e36345 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2934,8 +2934,7 @@ sub process {
 
 				# No spaces for:
 				#   ->
-				#   :   when part of a bitfield
-				} elsif ($op eq '->' || $opv eq ':B') {
+				} elsif ($op eq '->') {
 					if ($ctx =~ /Wx.|.xW/) {
 						if (ERROR("SPACING",
 							  "spaces prohibited around that '$op' $at\n" . $hereptr)) {
@@ -2947,6 +2946,19 @@ sub process {
 						}
 					}
 
+				#   :   when part of a bitfield
+				} elsif ($opv eq ':B') {
+					if ($ctx =~ /.xW/) {
+						if (ERROR("SPACING",
+							  "spaces prohibited after that '$op' $at\n" . $hereptr)) {
+							$good = $fix_elements[$n] . rtrim($fix_elements[$n + 1]);
+							if (defined $fix_elements[$n + 2]) {
+								$fix_elements[$n + 2] =~ s/^\s+//;
+							}
+							$line_fixed = 1;
+						}
+					}
+
 				# , must have a space on the right.
 				} elsif ($op eq ',') {
 					if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
-- 
1.8.4.rc3

--
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