public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes
@ 2014-07-25 22:19 Stephen Boyd
  2014-07-28  9:49 ` Torsten Duwe
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2014-07-25 22:19 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: linux-kernel, Matt Mackall, Herbert Xu, H . Peter Anvin,
	Torsten Duwe

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-05 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 22:19 [PATCH] hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes Stephen Boyd
2014-07-28  9:49 ` Torsten Duwe
2014-08-05 22:23   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox