From e02b876597777ab26288dd2611a97b597d14d661 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 349a3b852be9..33fd6633586d 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -342,7 +342,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; -- 2.20.1