fix typo/thinko in get_random_bytes()

If there is an architecture-specific random number generator we use it
to acquire randomness one "long" at a time.  We should put these random
words into consecutive words in the result buffer - not just overwrite
the first word again and again.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Luck, Tony 2011-11-16 10:50:56 -08:00 committed by Linus Torvalds
parent 869f8dfa52
commit bd29e568a4

View file

@ -941,7 +941,7 @@ void get_random_bytes(void *buf, int nbytes)
if (!arch_get_random_long(&v))
break;
memcpy(buf, &v, chunk);
memcpy(p, &v, chunk);
p += chunk;
nbytes -= chunk;
}