diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-06-07 09:44:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-25 11:49:13 +0200 |
commit | 81df8e227bd954e782a44b0abf6b83d499775c6c (patch) | |
tree | c3c2a98da6e790da5e3af1d73057cf76807180ce /drivers/char | |
parent | 6276675530778956e197b029a824625b3a02dec2 (diff) | |
download | linux-stable-81df8e227bd954e782a44b0abf6b83d499775c6c.tar.gz linux-stable-81df8e227bd954e782a44b0abf6b83d499775c6c.tar.bz2 linux-stable-81df8e227bd954e782a44b0abf6b83d499775c6c.zip |
random: avoid checking crng_ready() twice in random_init()
commit 9b29b6b20376ab64e1b043df6301d8a92378e631 upstream.
The current flow expands to:
if (crng_ready())
...
else if (...)
if (!crng_ready())
...
The second crng_ready() call is redundant, but can't so easily be
optimized out by the compiler.
This commit simplifies that to:
if (crng_ready()
...
else if (...)
...
Fixes: 560181c27b58 ("random: move initialization functions out of hot pages")
Cc: stable@vger.kernel.org
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 8b50ae54f06d..eb35adcbb69e 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -834,7 +834,7 @@ int __init random_init(const char *command_line) if (crng_ready()) crng_reseed(); else if (trust_cpu) - credit_init_bits(arch_bytes * 8); + _credit_init_bits(arch_bytes * 8); return 0; } |