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]
Message-ID: <1405984193.30871.10.camel@joe-AO725>
Date:	Mon, 21 Jul 2014 16:09:53 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Lee Jones <lee.jones@...aro.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] checkpatch: Fix false positive MISSING_BREAK warnings with
 --file

Using --file mode can give false positives with MISSING_BREAK
fall-through warnings on simple but long multiple consecutive
case statements.

Look for all lines before a case statement for a switch
or a statement when using --file mode.

Fix a misspelling of preceded while there.

Signed-off-by: Joe Perches <joe@...ches.com>
Reported-by: Lee Jones <lee.jones@...aro.org>
---

On Mon, 2014-07-21 at 14:30 -0700, Andrew Morton wrote:
> On Mon, 21 Jul 2014 07:28:49 -0700 Joe Perches <joe@...ches.com> wrote:
> 
> > I'll fix it soon.
> 
> wanna do s/preceeded/preceded/g while you're in there?

Sure.  It might be a few days though as
a generic fix seems non-trivial.

There's a trivial --file fix, but I'm not
sure the patch one is appropriate.

In the mean time, the case range label patch
should be OK to commit.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2258497..74afc7c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4766,13 +4766,13 @@ sub process {
 			}
 		}
 
-# check for case / default statements not preceeded by break/fallthrough/switch
+# check for case / default statements not preceded by break/fallthrough/switch
 		if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*(?:\.\.\.\s*(?:$Ident|$Constant)\s*)?|default):/) {
 			my $has_break = 0;
 			my $has_statement = 0;
 			my $count = 0;
 			my $prevline = $linenr;
-			while ($prevline > 1 && $count < 3 && !$has_break) {
+			while ($prevline > 1 && ($file || $count < 3) && !$has_break) {
 				$prevline--;
 				my $rline = $rawlines[$prevline - 1];
 				my $fline = $lines[$prevline - 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