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]
Message-ID: <1415649017.8868.15.camel@perches.com>
Date:	Mon, 10 Nov 2014 11:50:17 -0800
From:	Joe Perches <joe@...ches.com>
To:	Julius Werner <jwerner@...omium.org>
Cc:	Andy Whitcroft <apw@...onical.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2] checkpatch: Allow certain SI units with three
 characters

On Mon, 2014-11-10 at 11:39 -0800, Julius Werner wrote:
> Checkpatch flags CamelCase identifiers in strict mode, but it has a
> feature to ignore parts with only two characters to allow for SI units
> like mV or uA. Unfortunately, not all SI units fit in two characters,
> and not all are lower case followed by upper case.
> 
> This patch adds hardcoded detection for frequency and 1024-based size
> units (Hz/KHz/MHz/GHz/THz and KiB/MiB/GiB/TiB), since allowing any three
> character combinations might be too lenient. The list can later be
> expanded as needed.

Seems sensible enough, thanks.

Acked-by: Joe Perches <joe@...ches.com>

> Signed-off-by: Julius Werner <jwerner@...omium.org>
> ---
>  scripts/checkpatch.pl | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 374abf4..b947c75 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4056,7 +4056,9 @@ sub process {
>  #Ignore Page<foo> variants
>  			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
>  #Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
> -			    $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) {
> +			    $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/ &&
> +#Ignore some three character SI units explicitly, like MiB and KHz
> +			    $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
>  				while ($var =~ m{($Ident)}g) {
>  					my $word = $1;
>  					next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);



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