hwrng: Pass entropy to add_hwgenerator_randomness() in bits, not bytes
authorStephen Boyd <sboyd@codeaurora.org>
Fri, 25 Jul 2014 22:19:18 +0000 (15:19 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 5 Aug 2014 20:50:10 +0000 (16:50 -0400)
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 <duwe@suse.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
drivers/char/hw_random/core.c

index 349a3b852be991eeec75c147d8ed8d1ef7e66f5a..33fd6633586d1a3e269217865af4027c9b941282 100644 (file)
@@ -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;