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:
parent
869f8dfa52
commit
bd29e568a4
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue