summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorKeith Packard2015-03-18 08:17:00 +0100
committerHerbert Xu2015-03-18 11:01:31 +0100
commit506bf0c0464ace57169aadcf02ae397999c57bdd (patch)
treeaee118b7cffedee93f827aa55dc7cb71f91d0e97 /drivers/char
parentlinux-next: build failure after merge of the crypto tree (diff)
downloadkernel-qcow2-linux-506bf0c0464ace57169aadcf02ae397999c57bdd.tar.gz
kernel-qcow2-linux-506bf0c0464ace57169aadcf02ae397999c57bdd.tar.xz
kernel-qcow2-linux-506bf0c0464ace57169aadcf02ae397999c57bdd.zip
hwrng: core - allow perfect entropy from hardware devices
Hardware random number quality is measured from 0 (no entropy) to 1024 (perfect entropy). Allow hardware devices to assert the full range by truncating the device-provided value at 1024 instead of 1023. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 83161dde53ee..571ef61f8ea9 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -179,7 +179,8 @@ skip_init:
add_early_randomness(rng);
current_quality = rng->quality ? : default_quality;
- current_quality &= 1023;
+ if (current_quality > 1024)
+ current_quality = 1024;
if (current_quality == 0 && hwrng_fill)
kthread_stop(hwrng_fill);