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: <eb064d63c63c3ba711eb46edb8617a9d20a272e6.camel@perches.com>
Date:   Sun, 20 Jun 2021 12:20:54 -0700
From:   Joe Perches <joe@...ches.com>
To:     Guenter Roeck <linux@...ck-us.net>,
        Andy Whitcroft <apw@...onical.com>
Cc:     Dwaipayan Ray <dwaipayanray1@...il.com>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>,
        linux-kernel@...r.kernel.org,
        Ricardo Ribalda <ribalda@...omium.org>
Subject: Re: [PATCH] checkpatch: Do not complain about positive return
 values starting with EPOLL

On Sun, 2021-06-20 at 08:45 -0700, Guenter Roeck wrote:
> checkpatch complains about positive return values of poll functions.
> Example:
> 
> WARNING: return of an errno should typically be negative (ie: return -EPOLLIN)
> +		return EPOLLIN;
> 
> Poll functions return positive values. The defines for the return values
> of poll functions all start with EPOLL, resulting in a number of false
> positives. An often used workaround is to assign poll function return
> values to variables and returning that variable, but that is a less than
> perfect solution.
> 
> There is no error definition which starts with EPOLL, so it is safe to omit
> the warning for return values starting with EPOLL.

Seems OK but

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5458,7 +5458,8 @@ sub process {
>  # Return of what appears to be an errno should normally be negative
>  		if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
>  			my $name = $1;
> -			if ($name ne 'EOF' && $name ne 'ERROR') {
> +			if ($name ne 'EOF' && $name ne 'ERROR' &&
> +			    rindex($name, 'EPOLL', 0) != 0) {

rindex is a bit harder to read so my preference would be for the simpler:

			if ($name ne 'EOF' && $name ne 'ERROR' && $name !~ /^EPOLL/) {

>  				WARN("USE_NEGATIVE_ERRNO",
>  				     "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
>  			}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ