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]
Date:	Thu, 29 Oct 2015 15:46:21 -0700
From:	Joe Perches <joe@...ches.com>
To:	Vladimir Zapolskiy <vz@...ia.com>
Cc:	Andy Whitcroft <apw@...onical.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: fix a number of COMPLEX_MACRO false
 positives

On Thu, 2015-10-29 at 23:36 +0200, Vladimir Zapolskiy wrote:
> A simple search over the kernel souce displays a number of correctly
> defined multiline macro, which generally are used as an array element
> initializer:
> 
> % find ../linux -type f | xargs grep -B1 -H '^[:space]*\[.*\\$'
> 
> However checkpatch.pl unexpectedly complains about all these macro
> definitions:
> 
> % ./scripts/checkpatch.pl --types COMPLEX_MACRO -f include/linux/perf/arm_pmu.h
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> +#define PERF_MAP_ALL_UNSUPPORTED					\
> +	 [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED
> 
> The change intends to fix this type of false positives by flattening
> only array members and skipping array element designators.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@...ia.com>
> ---
>  scripts/checkpatch.pl | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f2a1131..3882893 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4526,7 +4526,7 @@ sub process {
>  			# Flatten any parentheses and braces
>  			while ($dstat =~ s/\([^\(\)]*\)/1/ ||
>  			       $dstat =~ s/\{[^\{\}]*\}/1/ ||
> -			       $dstat =~ s/\[[^\[\]]*\]/1/)
> +			       $dstat =~ s/.\[[^\[\]]*\]/1/)

Perhaps the . before the [ might be a bit broad.

I'm not sure there's a great way to handle this.

Andy?

>  			{
>  			}
>  
> @@ -4546,7 +4546,8 @@ sub process {
>  				union|
>  				struct|
>  				\.$Ident\s*=\s*|
> -				^\"|\"$
> +				^\"|\"$|
> +				^\[
>  			}x;
>  			#print "REST<$rest> dstat<$dstat> ctx<$ctx>\n";
>  			if ($dstat ne '' &&



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