40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
From: "Luck, Tony" <tony.luck@intel.com>
|
|
To: Linus Torvalds <torvalds@linux-foundation.org>,
|
|
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
|
|
Thomas Gleixner <tglx@linutronix.de>,
|
|
Fenghua Yu <fenghua.yu@intel.com>, Matt Mackall <mpm@selenic.com>,
|
|
Herbert Xu <herbert@gondor.hengli.com.au>,
|
|
"Theodore Ts'o" <tytso@mit.edu>, Jeff Garzik <jgarzik@pobox.com>,
|
|
Arjan van de Ven <arjan@linux.intel.com>, linux-kernel@vger.kernel.org
|
|
Subject: [PATCH] fix typo/thinko in get_random_bytes()
|
|
Date: Wed, 16 Nov 2011 10:50:56 -0800
|
|
Message-Id: <4ec4061010261a4cb0@agluck-desktop.sc.intel.com>
|
|
|
|
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>
|
|
|
|
---
|
|
|
|
diff --git a/drivers/char/random.c b/drivers/char/random.c
|
|
index 63e19ba..6035ab8 100644
|
|
--- a/drivers/char/random.c
|
|
+++ b/drivers/char/random.c
|
|
@@ -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;
|
|
}
|
|
--
|
|
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/
|
|
|