From: Stephen Boyd <sboyd@codeaurora.org>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"H . Peter Anvin" <hpa@zytor.com>, Torsten Duwe <duwe@suse.de>
Subject: [PATCH] hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes
Date: Fri, 25 Jul 2014 15:19:18 -0700 [thread overview]
Message-ID: <1406326758-4516-1-git-send-email-sboyd@codeaurora.org> (raw)
rng_get_data() returns the number of bytes read from the hardware.
The entropy argument to add_hwgenerator_randomness() is passed
directly to credit_entropy_bits() so we should be passing the
number of bits, not bytes here.
Fixes: be4000bc464 "hwrng: create filler thread"
Cc: Torsten Duwe <duwe@suse.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
drivers/char/hw_random/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index dc80cdab733d..6e02ec103cc7 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -362,7 +362,7 @@ static int hwrng_fillfn(void *unused)
continue;
}
add_hwgenerator_randomness((void *)rng_fillbuf, rc,
- (rc*current_quality)>>10);
+ rc * current_quality * 8 >> 10);
}
hwrng_fill = NULL;
return 0;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next reply other threads:[~2014-07-25 22:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 22:19 Stephen Boyd [this message]
2014-07-28 9:49 ` [PATCH] hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes Torsten Duwe
2014-08-05 22:23 ` Theodore Ts'o
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=1406326758-4516-1-git-send-email-sboyd@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=duwe@suse.de \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--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