Commit 763b54f0 authored by Matt Mackall's avatar Matt Mackall Committed by Linus Torvalds

[PATCH] random: simplify initialization

Simplify the init code
Signed-off-by: default avatarMatt Mackall <mpm@selenic.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 41aff741
...@@ -1485,9 +1485,6 @@ EXPORT_SYMBOL(get_random_bytes); ...@@ -1485,9 +1485,6 @@ EXPORT_SYMBOL(get_random_bytes);
static void init_std_data(struct entropy_store *r) static void init_std_data(struct entropy_store *r)
{ {
struct timeval tv; struct timeval tv;
__u32 words[2];
char *p;
int i;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&r->lock, flags); spin_lock_irqsave(&r->lock, flags);
...@@ -1495,20 +1492,9 @@ static void init_std_data(struct entropy_store *r) ...@@ -1495,20 +1492,9 @@ static void init_std_data(struct entropy_store *r)
spin_unlock_irqrestore(&r->lock, flags); spin_unlock_irqrestore(&r->lock, flags);
do_gettimeofday(&tv); do_gettimeofday(&tv);
words[0] = tv.tv_sec; add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4);
words[1] = tv.tv_usec; add_entropy_words(r, (__u32 *)&system_utsname,
add_entropy_words(r, words, 2); sizeof(system_utsname)/4);
/*
* This doesn't lock system.utsname. However, we are generating
* entropy so a race with a name set here is fine.
*/
p = (char *) &system_utsname;
for (i = sizeof(system_utsname) / sizeof(words); i; i--) {
memcpy(words, p, sizeof(words));
add_entropy_words(r, words, sizeof(words)/4);
p += sizeof(words);
}
} }
static int __init rand_initialize(void) static int __init rand_initialize(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment