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]
Date:	Wed, 22 Jul 2015 13:35:46 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Dexuan Cui <decui@...rosoft.com>
Cc:	Vitaly Kuznetsov <vkuznets@...hat.com>,
	"olaf@...fle.de" <olaf@...fle.de>,
	"pebolle@...cali.nl" <pebolle@...cali.nl>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"jasowang@...hat.com" <jasowang@...hat.com>,
	"driverdev-devel@...uxdriverproject.org" 
	<driverdev-devel@...uxdriverproject.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"stephen@...workplumber.org" <stephen@...workplumber.org>,
	"stefanha@...hat.com" <stefanha@...hat.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"apw@...onical.com" <apw@...onical.com>,
	"davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock
 packet and get the r/w-ability

On Wed, Jul 22, 2015 at 10:09:10AM +0000, Dexuan Cui wrote:
> > I'd suggest you do something like
> > 
> >     if (ret == -EAGIAIN)
> >         return 0;
> >     else if (ret)
> >         return ret;
> > 
> > to make it future-proof (e.g. when a new error is returned by
> > hv_ringbuffer_peek). And a comment would also be useful as it is unclear
> > why we silence errors here.
> Hi Vitaly,
> Thanks! 
> I think I made a mistake here:
> the "if (ret != 0) return 0;" should be changed
> to   "if (ret != 0) return ret;"

The double negative really doesn't not make the code more complicated.
I like using a quadruple negative instead.

	if (ret != 0 != 0)
		return ret;

regards,
dan carpenter


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