diff options
| author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-06-13 10:07:47 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 18:41:51 +0200 |
| commit | 7ccc3457dbe5b27b2de86d45f2e730f4f38cbce3 (patch) | |
| tree | 5eb092eb51194db7b1f102de7b42740761a021d4 | |
| parent | e9993a9c6dc1274831e81ef4ff63ccccf1aa61d5 (diff) | |
| download | linux-stable-7ccc3457dbe5b27b2de86d45f2e730f4f38cbce3.tar.gz linux-stable-7ccc3457dbe5b27b2de86d45f2e730f4f38cbce3.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>
| -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 d6aa4b57d985..2edc07bd2fce 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -838,7 +838,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; } |
