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: <74934d9a6a53af38eb44e9062784ef720dac2a60.camel@perches.com>
Date:   Fri, 17 Apr 2020 11:55:41 -0700
From:   Joe Perches <joe@...ches.com>
To:     Luben Tuikov <luben.tuikov@....com>,
        Andy Whitcroft <apw@...onical.com>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Re: checkpatch.pl warning for "return" with value

On Fri, 2020-04-17 at 14:52 -0400, Luben Tuikov wrote:
> On 2020-04-17 1:32 p.m., Joe Perches wrote:
[]
> > 	if (<atypical_condition>) {
> > 		...;
> > 		return <atypical_result>;
> > 	}
> > 
> > 	...;
> > 	return <typical_result>;
> > }
> > 
> > If you want to code it, and it works, go ahead, but I
> > won't attempt it because I think it's not appropriate.
> 
> For error checking, when the 2nd ellipsis is
> a long, long body of the function, so that the error
> checking is done at the top, then long body,
> then at the bottom we return some computed value.
> But in the case I have above, it's a compact if-else
> at the bottom of the function.

which could not be differentiated from a function like

{
	...;
	err = func(...);
	if (err) {
		report("err: %d\n", err);
		return err;
	}

	...;
	return 0;

> In the example I gave above, there is no "typical" or
> "atypical" condition--it's just checking a condition
> and deciding what to do, all at the bottom of
> a function. (And that condition, samples
> an external stimuli, which cannot be predicted.)
[]
> Since we're returning a different result and since
> it works fine with a triplet, could you fix the binary
> case above to not complain?

No.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ