diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-09-27 11:26:44 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-09-29 21:37:27 +0200 |
commit | dd54fd7dfa4574fe350b75a90693dc6552c535e3 (patch) | |
tree | e5c63f9a0579050ef1d5cd4dc09f258522f5f915 /drivers/char/random.c | |
parent | kfence: use better stack hash seed (diff) | |
download | linux-dd54fd7dfa4574fe350b75a90693dc6552c535e3.tar.xz linux-dd54fd7dfa4574fe350b75a90693dc6552c535e3.zip |
random: use init_utsname() instead of utsname()
Rather than going through the current-> indirection for utsname, at this
point in boot, init_utsname()==utsname(), so just use it directly that
way. Additionally, init_utsname() appears to be available nearly always,
so move it into random_init_early().
Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'drivers/char/random.c')
-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 1427f66252c6..f2aa3ab1b458 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -802,6 +802,7 @@ void __init random_init_early(const char *command_line) ++i; } + _mix_pool_bytes(init_utsname(), sizeof(*(init_utsname()))); _mix_pool_bytes(command_line, strlen(command_line)); /* Reseed if already seeded by earlier phases. */ @@ -820,7 +821,6 @@ void __init random_init(void) unsigned long entropy = random_get_entropy(); ktime_t now = ktime_get_real(); - _mix_pool_bytes(utsname(), sizeof(*(utsname()))); _mix_pool_bytes(&now, sizeof(now)); _mix_pool_bytes(&entropy, sizeof(entropy)); add_latent_entropy(); |