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: <4ce25249a42248e7762f22f40d6d9898365024ea.camel@perches.com>
Date:   Wed, 24 Jul 2019 11:03:35 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Andy Whitcroft <apw@...onical.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/12] checkpatch: Add GENMASK tests

On Tue, 2019-07-09 at 22:04 -0700, Joe Perches wrote:
> This macro is easy to misuse as it's odd argument order.
> 
> If specified with simple decimal values, make sure the arguments are
> ordered high then low.
> 
> Also check if any argument is > 32 where instead of GENMASK,
> GENMASK_ULL should be used.

Hey Andrew, can you add this please.

> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  scripts/checkpatch.pl | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 6cb99ec62000..d37bbe33524b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6368,6 +6368,21 @@ sub process {
>  			     "switch default: should use break\n" . $herectx);
>  		}
>  
> +# check for misuses of GENMASK
> +		if ($line =~ /\b(GENMASK(?:_ULL)?)\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)/) {
> +			my $type = $1;
> +			my $high = $2;
> +			my $low = $3;
> +			if ($high < $low) {
> +				ERROR("GENMASK",
> +				      "$type argument order is high then low\n" . $herecurr);
> +			}
> +			if ($type eq "GENMASK" && ($high >= 32 || $low >= 32)) {
> +				ERROR("GENMASK",
> +				      "$type with arguments >= 32 should use GENMASK_ULL\n" . $herecurr);
> +			}
> +		}
> +
>  # check for gcc specific __FUNCTION__
>  		if ($line =~ /\b__FUNCTION__\b/) {
>  			if (WARN("USE_FUNC",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ