From 7740dd2d25ca55fc77bd13cd0e95447a08869418 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Fri, 25 Jul 2014 15:19:18 -0700 Subject: [PATCH] hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes 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" Acked-by: Torsten Duwe Signed-off-by: Stephen Boyd Signed-off-by: Theodore Ts'o --- 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 f5df8a33127c..cdb8f1e10b83 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -333,7 +333,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;