]> git.baikalelectronics.ru Git - kernel.git/commit
random: simplify arithmetic function flow in account()
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 17 Jan 2022 17:43:02 +0000 (18:43 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 18 Jan 2022 12:03:56 +0000 (13:03 +0100)
commit9fb3f12485080455a5b6ebc1166206f2b5f5b40f
treeaa031d332af951e2a787eb8b000f4629a00efcc8
parent06034d5938d54f1d31a913e069461ffaa3b29ab0
random: simplify arithmetic function flow in account()

Now that have_bytes is never modified, we can simplify this function.
First, we move the check for negative entropy_count to be first. That
ensures that subsequent reads of this will be non-negative. Then,
have_bytes and ibytes can be folded into their one use site in the
min_t() function.

Suggested-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c