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>] [day] [month] [year] [list]
Message-ID: <DC148C5AA1CEBA4E87973D432B1C2D88261D7FFB@P3PWEX4MB008.ex4.secureserver.net>
Date:	Wed, 6 May 2015 15:45:17 +0000
From:	Hartley Sweeten <HartleyS@...ionengravers.com>
To:	nick <xerofoify@...il.com>, Ian Abbott <abbotti@....co.uk>
CC:	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"chase.southwood@...il.com" <chase.southwood@...il.com>,
	"ebru.akagunduz@...il.com" <ebru.akagunduz@...il.com>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: Question about the function,ni_stc_dma_channel_select_bitfield

On Wednesday, May 06, 2015 7:06 AM, nick wrote:
> On 2015-05-06 05:10 AM, Ian Abbott wrote:
>> On 06/05/15 01:22, nick wrote:
>>> Greetings All,
>>> I am wondering if in the function,ni_stc_dma_channel_select_bitfield the line:
>>> return 1 << channel;
>>> is guaranteed to be below the threshold that guarantees us to not overflow on
>>> a unsigned 32 integer due to bit wise shifting to the left.
>>> Thanks Nick
>>>
>> 
>>     if (channel < 4)
>>         return 1 << channel;
>> 
>> So, yes.
>> 
> This should be commented in my option as this is not common knowledge
> unless you known the hardware specs really well. If I should send in
> a patch adding a comment here please let me known.

A comment is not necessary. The code explicitly states that channel (an unsigned var)
needs to be < 4 for the bit shift to happen.

Hartley

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ