From: "tip-bot for Luck, Tony" <tony.luck@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
tony.luck@intel.com, tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/urgent] random: Fix handing of arch_get_random_long in get_random_bytes()
Date: Fri, 18 Nov 2011 15:45:57 -0800 [thread overview]
Message-ID: <tip-0d2f096b8785b67c38afcf6e1fbb9674af2e05ca@git.kernel.org> (raw)
In-Reply-To: <4ec4061010261a4cb0@agluck-desktop.sc.intel.com>
Commit-ID: 0d2f096b8785b67c38afcf6e1fbb9674af2e05ca
Gitweb: http://git.kernel.org/tip/0d2f096b8785b67c38afcf6e1fbb9674af2e05ca
Author: Luck, Tony <tony.luck@intel.com>
AuthorDate: Wed, 16 Nov 2011 10:50:56 -0800
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 16 Nov 2011 16:41:02 -0800
random: Fix handing of arch_get_random_long 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: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/4ec4061010261a4cb0@agluck-desktop.sc.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
drivers/char/random.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
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;
}
prev parent reply other threads:[~2011-11-18 23:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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-bot for Luck, Tony [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-0d2f096b8785b67c38afcf6e1fbb9674af2e05ca@git.kernel.org \
--to=tony.luck@intel.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox