lkml.org 
[lkml]   [2014]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: drivers: random: Shift out-of-bounds in _mix_pool_bytes
On 10/24/2014 06:22 PM, H. Peter Anvin wrote:
>> By the principle of least surprise, I would expect "__u32 >> N", where
>> > N >= 32 to return zero instead of random garbage. For N < 32 it will
>> > return progressively smaller numbers, until it has shifted away all of
>> > the set bits, at which turn it will return 0. For it suddenly to jump
>> > up once N = 32 is used, is counter-intuitive.
>> >
> That's why it is undefined.

Now I'm curious about things like "memcpy(ptr, NULL, 0)". According to the
standard they're undefined, and since we're using gcc's implementation for
memcpy() we are doing "undefined memcpy" in quite a few places in the kernel.

Is it an issue, or would you expect memcpy() to not deref the "from" ptr
since length is 0?


Thanks,
Sasha


\
 
 \ /
  Last update: 2014-10-25 03:21    [W:0.153 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site