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]
Date:	Sat, 24 Oct 2015 12:56:49 +0100
From:	Luis de Bethencourt <luisbg@....samsung.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	florian.c.schilhabel@...glemail.com, punitvara@...il.com,
	stillcompiling@...il.com, luca@...aceresoli.net,
	carlos@...rcia.org, Julia.Lawall@...6.fr, vthakkar1994@...il.com,
	gregkh@...uxfoundation.org, cristina.opriceana@...il.com,
	fabf@...net.be, shivanib134@...il.com, jteki@...nedev.com,
	sudipm.mukherjee@...il.com, Larry.Finger@...inger.net
Subject: Re: [PATCH v2 1/3] staging: rtl8712: Remove boolean comparisons

On 22/10/15 20:05, Dan Carpenter wrote:
> On Mon, Oct 19, 2015 at 06:14:29PM +0100, Luis de Bethencourt wrote:
>> Boolean tests do not need explicit comparison to true or false.
>>
>> Signed-off-by: Luis de Bethencourt <luisbg@....samsung.com>
>> ---
>> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
>> index c940722..e33eeed 100644
>> --- a/drivers/staging/rtl8712/usb_ops_linux.c
>> +++ b/drivers/staging/rtl8712/usb_ops_linux.c
>> @@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
>>  	if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
>>  	    adapter->pwrctrlpriv.pnp_bstop_trx)
>>  		return _FAIL;
>> -	if (!precvbuf->reuse == false || !precvbuf->pskb) {
>> +	if (precvbuf->reuse || !precvbuf->pskb) {
>>  		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
>>  		if (precvbuf->pskb != NULL)
>>  			precvbuf->reuse = true;
> 
> You have transformed this faithfully, but my instinct says that the
> original code is wrong.  It should be:
> 
> 	if (!precvbuf->reuse || !precvbuf->pskb) {
> 
> I checked and usb_read_port() is implemented this way in
> drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c.  Again I am going on
> instinct and not a full understanding of the code, but I'm probably
> correct.
> 
> Anyway, this is not related to the patch so we should fix it in a later
> patch, but let's not forget.
> 
> TODO: rtl8712: fix a reversed condition in r8712_usb_read_port()
> 
> regards,
> dan carpenter
> 

Hi Dan,

Thank you for the review. I will study the code and make sure that your
intuition is correct, which initially it sounds to be.

Thanks,
Luis
--
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