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] [day] [month] [year] [list]
Date:	Wed, 11 Jan 2012 12:43:02 -0800
From:	Joe Perches <joe@...ches.com>
To:	Andy Whitcroft <apw@...dowen.org>
Cc:	Dan Carpenter <dan.carpenter@...cle.com>,
	Julian Andres Klode <jak@...-linux.org>,
	devel@...verdev.osuosl.org, Greg Kroah-Hartman <gregkh@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] checkpatch: Add warning for asymmetric brace use

On Wed, 2012-01-11 at 11:58 -0800, Joe Perches wrote:
> Here's a possible checkpatch patch.
> It seems to work on the test cases I've tried.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +				if ($seen) {
> +					my $sum_allowed = 0;
> +					foreach (@allowed) {
> +						$sum_allowed += $_;
> +					}
> +					if ($sum_allowed == 0) {
> +						WARN("BRACES",
> +						     "braces {} are not necessary for any arm of this statement\n" . $herectx);
> +					} elsif ($sum_allowed != $allow) {

I ran some more tests against the kernel source.
This works better as:

+					} elsif ($sum_allowed != $allow &&
+						 $seen != $allow) {

> +						WARN("BRACES",
> +						     "braces {} should be used on all arms of this statement\n" . $herectx);
> +					}



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