All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix typo/thinko in get_random_bytes()
@ 2011-11-16 18:50 Luck, Tony
  2011-11-16 19:34 ` H. Peter Anvin
  2011-11-18 23:45 ` [tip:x86/urgent] random: Fix handing of arch_get_random_long " tip-bot for Luck, Tony
  0 siblings, 2 replies; 5+ messages in thread
From: Luck, Tony @ 2011-11-16 18:50 UTC (permalink / raw)
  To: Linus Torvalds, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	Fenghua Yu, Matt Mackall, Herbert Xu, Theodore Ts'o,
	Jeff Garzik, Arjan van de Ven, linux-kernel

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;
 	}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-18 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16 18:50 [PATCH] fix typo/thinko in get_random_bytes() Luck, Tony
2011-11-16 19:34 ` H. Peter Anvin
2011-11-16 19:41   ` Thomas Gleixner
2011-11-17 16:34     ` H. Peter Anvin
2011-11-18 23:45 ` [tip:x86/urgent] random: Fix handing of arch_get_random_long " tip-bot for Luck, Tony

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.