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: <032c06a8-e9ce-9c06-d142-70bfeae2117a@linux.vnet.ibm.com>
Date:   Tue, 23 Jan 2018 12:44:01 +0100
From:   Ursula Braun <ubraun@...ux.vnet.ibm.com>
To:     Joe Perches <joe@...ches.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        "David S. Miller" <davem@...emloft.net>
Cc:     linux-s390@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Subject: Re: [PATCH v2] smc: return booleans instead of integers



On 01/23/2018 01:31 AM, Joe Perches wrote:
> On Mon, 2018-01-22 at 12:58 +0100, Ursula Braun wrote:
>>
>> On 01/19/2018 09:54 PM, Gustavo A. R. Silva wrote:
>>> Return statements in functions returning bool should use
>>> true/false instead of 1/0.
>>>
>>> This issue was detected with the help of Coccinelle.
>>>
>>> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
>>> ---
>>> Changes in v2:
>>>  - Fix function using_ipsec as suggested by Ursula Braun.
>>>  - Update subject line.
>>>
>>>  net/smc/smc.h | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/net/smc/smc.h b/net/smc/smc.h
> []
>>> @@ -253,12 +253,12 @@ static inline int smc_uncompress_bufsize(u8 compressed)
>>>  static inline bool using_ipsec(struct smc_sock *smc)
>>>  {
>>>  	return (smc->clcsock->sk->sk_policy[0] ||
>>> -		smc->clcsock->sk->sk_policy[1]) ? 1 : 0;
>>> +		smc->clcsock->sk->sk_policy[1]) ? true : false;
> 
> Generally, any bool return like
> 
> 	return condition ? true : false;
> 
> could be written
> 
> 	return condition;
> 
This would be shorter, but is it really better readable/understandable?
Do you have a reference for us confirming your proposed style is the way to go?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ