From: Stephen Boyd Date: Fri, 25 Jul 2014 22:19:18 +0000 (-0700) Subject: hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e02b876597777ab26288dd2611a97b597d14d661;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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;