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: <1375745420.1968.13.camel@joe-AO722>
Date:	Mon, 05 Aug 2013 16:30:20 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	apw@...onical.com, linux-kernel@...r.kernel.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] checkpatch: add a rule to check devinitconst mistakes

On Mon, 2013-08-05 at 15:10 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
> 
> Check for const __devinitdata and non const __devinitconst
> 
> People get this regularly wrong and it breaks the LTO builds,
> as it causes a section attribute conflict.
> 
> This doesn't catch all mistakes -- spreading over multiple lines,
> getting const pointers wrong, but hopefully the common ones.
> 
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
>  scripts/checkpatch.pl | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2ee9eb7..5d68d9c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2676,6 +2676,15 @@ sub process {
>  			}
>  		}
>  
> +# check for __devinitdata with const or const without __devintconst
> +# XXX should scan multiple lines and handle misplaced consts for pointers
> +		if ($line =~ /const/ && $line =~ /__(dev)?initdata/) {
> +		    ERROR("DEVINITCONST", "const init definition must use __devinitconst");
> +		}
> +		if ($line =~ /__(dev)?initconst/ && $line !~ /\Wconst\W/) {

There are no more uses of __devinitconst and
__devinitdata in the tree.

Shouldn't these be "\bconst\b", "\b__initdata\b"
and "\b__initconst\b"

I think also there'll be a few too many false
positives for function arguments.

It seems that every use of __initconst is of
the form

[static] const <type> [name] __initconst so

	if ($line =~ /\b__initconst\b/ &&
	    $line !~ /^\+\s*(?:static\b)?\s*const\s+$Type\s*(?:$Ident)?\s*__initconst\b/) {
		etc...
	}

should work reasonably well.

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