public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@redhat.com>, Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] random.c compiler warning
Date: Sat, 27 Oct 2001 06:40:47 +0200	[thread overview]
Message-ID: <m15xL0M-007qc9C@smtp.web.de> (raw)

Hi all,

the patch below removes a compiler warning in random.c. To be exact
it's the first hunk of the patch that does it. There's a comparision
between signed and unsigned values which triggers that warning.

The rest of the patch is just there for consistency and because it just
looks better to me. Those sizeof()s were introduced in kernel 2.4.13, I
just can't imagine why. Care to explain anyone?

René



--- linux-2.4.14-pre2/drivers/char/random.c	Fri Oct 26 23:07:16 2001
+++ linux-2.4.14-pre2-rs/drivers/char/random.c	Sat Oct 27 05:34:34 2001
@@ -1246,7 +1246,7 @@
 	if (r->entropy_count < nbytes * 8 &&
 	    r->entropy_count < r->poolinfo.POOLBITS) {
 		int nwords = min(r->poolinfo.poolwords - r->entropy_count/32,
-				 sizeof(tmp) / 4);
+				 TMP_BUF_SIZE);
 
 		DEBUG_ENT("xfer %d from primary to %s (have %d, need %d)\n",
 			  nwords * 32,
@@ -1260,9 +1260,9 @@
 	if (r->extract_count > 1024) {
 		DEBUG_ENT("reseeding %s with %d from primary\n",
 			  r == sec_random_state ? "secondary" : "unknown",
-			  sizeof(tmp) * 8);
-		extract_entropy(random_state, tmp, sizeof(tmp), 0);
-		add_entropy_words(r, tmp, sizeof(tmp) / 4);
+			  TMP_BUF_SIZE * 32);
+		extract_entropy(random_state, tmp, TMP_BUF_SIZE * 4, 0);
+		add_entropy_words(r, tmp, TMP_BUF_SIZE);
 		r->extract_count = 0;
 	}
 }


                 reply	other threads:[~2001-10-27  4:23 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=m15xL0M-007qc9C@smtp.web.de \
    --to=l.s.r@web.de \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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