public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>, "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/10] random pt2: simplify initialization
Date: Fri, 14 Jan 2005 18:49:07 -0600	[thread overview]
Message-ID: <6.563253706@selenic.com> (raw)
In-Reply-To: <5.563253706@selenic.com>

Simplify the init code

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: rnd/drivers/char/random.c
===================================================================
--- rnd.orig/drivers/char/random.c	2005-01-12 21:28:02.593185340 -0800
+++ rnd/drivers/char/random.c	2005-01-12 21:28:03.909017586 -0800
@@ -1485,9 +1485,6 @@
 static void init_std_data(struct entropy_store *r)
 {
 	struct timeval tv;
-	__u32 words[2];
-	char *p;
-	int i;
 	unsigned long flags;
 
 	spin_lock_irqsave(&r->lock, flags);
@@ -1495,20 +1492,9 @@
 	spin_unlock_irqrestore(&r->lock, flags);
 
 	do_gettimeofday(&tv);
-	words[0] = tv.tv_sec;
-	words[1] = tv.tv_usec;
-	add_entropy_words(r, words, 2);
-
-	/*
-	 *	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);
-	}
+	add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4);
+	add_entropy_words(r, (__u32 *)&system_utsname,
+			  sizeof(system_utsname)/4);
 }
 
 static int __init rand_initialize(void)

  reply	other threads:[~2005-01-15  0:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-15  0:49 [PATCH 1/10] random pt2: cleanup waitqueue logic, fix missed wakeup Matt Mackall
2005-01-15  0:49 ` [PATCH 2/10] random pt2: kill pool clearing Matt Mackall
2005-01-15  0:49   ` [PATCH 3/10] random pt2: combine legacy ioctls Matt Mackall
2005-01-15  0:49     ` [PATCH 4/10] random pt2: re-init all pools on zero Matt Mackall
2005-01-15  0:49       ` Matt Mackall [this message]
2005-01-15  0:49         ` [PATCH 6/10] random pt2: kill memsets of static data Matt Mackall
2005-01-15  0:49           ` [PATCH 7/10] random pt2: kill dead extract_state struct Matt Mackall
2005-01-15  0:49             ` [PATCH 8/10] random pt2: kill 2.2 compat waitqueue defs Matt Mackall
2005-01-15  0:49               ` [PATCH 9/10] random pt2: kill redundant rotate_left definitions Matt Mackall
2005-01-15  0:49                 ` [PATCH 10/10] random pt2: kill misnamed log2 Matt Mackall

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=6.563253706@selenic.com \
    --to=mpm@selenic.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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