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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <054ce1000f13fb321b84ac474957a759633e5a9d.1513430008.git-series.knut.omang@oracle.com>
Date:   Sat, 16 Dec 2017 15:42:28 +0100
From:   Knut Omang <knut.omang@...cle.com>
To:     linux-kernel@...r.kernel.org
Cc:     Knut Omang <knut.omang@...cle.com>, Joe Perches <joe@...ches.com>,
        Andy Whitcroft <apw@...onical.com>
Subject: [PATCH v2 3/5] checkpatch: Improve --fix-inplace for TABSTOP

If the --fix-inplace option for TABSTOP encounters a sitation with several
spaces (but less than 8) at the end of an indentation, it will assume that there
are extra indentation and align back to the nearest tabstop instead of the next.

This might go undetected in a "full" checkpatch --fix-inplace run, as this
potential new error will be handled by SUSPECT_CODE_INDENT further down in the
script.  The code for TABSTOP have limited "knowledge" of the previous line.
Adding complexity when it is taken care of later anyway is maybe unnecessary/undesired.
As a simple heuristics just use a "natural" rounding algorithm and round
up for 4 spaces or more.

There's an example in line 108 in net/rds/ib_recv.c with indentation TAB + 7
spaces where the correct would have been an additional TAB.  With only TABSTOP
enabled, checkpatch will fix this to a single TAB, which is visually worse IMO.

Reported-by: Håkon Bugge <haakon.bugge@...cle.com>
Signed-off-by: Knut Omang <knut.omang@...cle.com>
Reviewed-by: Håkon Bugge <haakon.bugge@...cle.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 040aa79..febe010 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2989,7 +2989,7 @@ sub process {
 				if (WARN("TABSTOP",
 					 "Statements should start on a tabstop\n" . $herecurr) &&
 				    $fix) {
-					$fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/8)@e;
+					$fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x (($indent+4)/8)@e;
 				}
 			}
 		}
-- 
git-series 0.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ