linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: George Spelvin <linux@horizon.com>
To: penberg@cs.helsinki.fi, herbert@gondor.apana.org.au, mpm@selenic.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux@horizon.com
Subject: [PATCH 3/8] drivers/char/random: make get_random_int_hash a structure
Date: Mon, 14 Mar 2011 12:46:32 -0400	[thread overview]
Message-ID: <20110316022804.27692.qmail@science.horizon.com> (raw)

We'll need to add some fields to it in later work.
---
 drivers/char/random.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index fdbf7b6..113508e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1624,7 +1624,10 @@ EXPORT_SYMBOL(secure_dccp_sequence_number);
  * value is not strongly cryptographically secure, but for several uses the
  * cost of depleting entropy is too high.
  */
-DEFINE_PER_CPU(__u32 [4], get_random_int_hash);
+struct cpu_random {
+	u32 hash[4];
+};
+DEFINE_PER_CPU(struct cpu_random, get_random_int_data);
 static u32 __get_random_int(u32 *hash)
 {
 	struct keydata const *keyptr = get_keyptr();
@@ -1640,10 +1643,10 @@ static u32 __get_random_int(u32 *hash)
 
 unsigned int get_random_int(void)
 {
-	u32 *hash = get_cpu_var(get_random_int_hash);
-	u32 ret = __get_random_int(hash);
+	struct cpu_random *r = &get_cpu_var(get_random_int_data);
+	u32 ret = __get_random_int(r->hash);
 
-	put_cpu_var(get_random_int_hash);
+	put_cpu_var(r);
 	return ret;
 }
 
-- 
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2011-03-16  2:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110316022804.27692.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).