lkml.org 
[lkml]   [2008]   [Jul]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 2 Jul 2008 08:38:16 +0200 (CEST)
FromJan Engelhardt <>
SubjectRe: Bug in random32.c: all-zero outputs with probability 1/2^32, other seeding bugs
On Wednesday 2008-07-02 01:19, Benoit Boissinot wrote:
>@@ -122,7 +122,7 @@
[ int i ]
>
> 	for_each_possible_cpu(i) {
> 		struct rnd_state *state = &per_cpu(net_rand_state,i);
>-		__set_random32(state, i + jiffies);
>+		__set_random32(state, (u32) i + jiffies);
> 	}
> 	return 0;
> }

This cast does not make sense since
 (int)i + jiffies ≡ i + jiffies ≡ (u32)i + jiffies          mod 2^32
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-07-02 08:41    [from the cache]
©2003-2008