random: make credit_entropy_bits() always safe
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 4 Feb 2022 00:45:53 +0000 (01:45 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 Feb 2022 15:48:06 +0000 (16:48 +0100)
commita49c010e61e1938be851f5e49ac219d49b704103
treee6e21870540911035caa454ceea1036ce26e1402
parent489c7fc44b5740d377e8cfdbf0851036e493af00
random: make credit_entropy_bits() always safe

This is called from various hwgenerator drivers, so rather than having
one "safe" version for userspace and one "unsafe" version for the
kernel, just make everything safe; the checks are cheap and sensible to
have anyway.

Reported-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c