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: <1386284955.10003.20.camel@joe-AO722>
Date:	Thu, 05 Dec 2013 15:09:15 -0800
From:	Joe Perches <joe@...ches.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	Will Tange <bh34rt@...il.com>, gregkh@...uxfoundation.org,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: silicom: fix 'return is not a function,
 parentheses are not required' in bpctl_mod.c

On Fri, 2013-12-06 at 01:50 +0300, Dan Carpenter wrote:
> On Thu, Dec 05, 2013 at 10:23:53PM +0100, Will Tange wrote:
> > Fixes warnings regarding redundant parantheses thrown by the checkpatch tool in bpctl_mod.c
[]
> 	if (ret < 0)
> 		return BP_NOT_CAP;
> 	if (ret == 0)
> 		return 1;
> 	return 0;
> 
> More lines, but simpler to understand than the original.
> 
> Think of checkpatch.pl as a pointer to bad code and not that we just
> have to silence checkpatch and move on.

So true.

If 0 is the expected ret value and 1 is the
expected function return for not-errored use,
I suggest changing the last bit to:

	if (ret < 0)
		return BP_NOT_CAP;
	else if (ret > 0)
		return 0;

	return 1;

so that the error conditions are done first
and the normal return is at the bottom of
the function.


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