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: <CAHp75Vf4V1w3_8rF3ukf9Lydd9OGg7pTeAsiUXiqognD4Mp36g@mail.gmail.com>
Date:	Mon, 8 Feb 2016 17:11:44 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Lars-Peter Clausen <lars@...afoo.de>
Cc:	Bhumika Goyal <bhumirks@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	jic23@...nel.org, knaack.h@....de,
	Peter Meerwald-Stadler <pmeerw@...erw.net>,
	linux-iio@...r.kernel.org, devel@...verdev.osuosl.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] Staging:iio:Prefer using BIT macro

On Mon, Feb 8, 2016 at 11:14 AM, Lars-Peter Clausen <lars@...afoo.de> wrote:
> On 02/08/2016 07:48 AM, Bhumika Goyal wrote:

>>               value = (s8)((data >> AD7816_TEMP_FLOAT_OFFSET) - 103);
>>               data &= AD7816_TEMP_FLOAT_MASK;
>>               if (value < 0)
>> -                     data = (1 << AD7816_TEMP_FLOAT_OFFSET) - data;
>> +                     data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
>
>
> But in this case this is a false positive. The intended semantic meaning
> here is 2**... not BIT(...). Using BIT() here in my opinion only causes
> confusion.

+1. Here clearly the intention is to change sign of the value which
fits less than 32/16/8 bits. 1 << OFFSET represents '-0'.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ