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: <20200917122529.GJ3956970@smile.fi.intel.com>
Date:   Thu, 17 Sep 2020 15:25:29 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Daniel Scally <djrscally@...il.com>,
        devel@...verdev.osuosl.org, robh@...nel.org,
        jorhand@...ux.microsoft.com, linux-media@...r.kernel.org,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        kieran.bingham@...asonboard.com, kitakar@...il.com,
        bingbu.cao@...el.com, mchehab@...nel.org, davem@...emloft.net,
        tian.shu.qiu@...el.com, yong.zhi@...el.com
Subject: Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device
 via software nodes on ACPI platforms

On Thu, Sep 17, 2020 at 01:49:41PM +0300, Dan Carpenter wrote:
> On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote:

> > > +	int i, ret;
> > 
> > unsigned int i
> > 
> 
> Why?
> 
> For list iterators then "int i;" is best...  For sizes then unsigned is
> sometimes best.  Or if it's part of the hardware spec or network spec
> unsigned is best.  Otherwise unsigned variables cause a ton of bugs.
> They're not as intuitive as signed variables.  Imagine if there is an
> error in this loop and you want to unwind.  With a signed variable you
> can do:
> 
> 	while (--i >= 0)
> 		cleanup(&bridge.sensors[i]);

Ha-ha. It's actually a counter argument to your stuff because above is the same as

	while (i--)
		cleanup(&bridge.sensors[i]);

with pretty much unsigned int i.

> There are very few times where raising the type maximum from 2 billion
> to 4 billion fixes anything.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ