Commit 39e0f991 authored by Jason A. Donenfeld's avatar Jason A. Donenfeld

random: mark bootloader randomness code as __init

add_bootloader_randomness() and the variables it touches are only used
during __init and not after, so mark these as __init. At the same time,
unexport this, since it's only called by other __init code that's
built-in.

Cc: stable@vger.kernel.org
Fixes: 428826f5 ("fdt: add support for rng-seed")
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent 9b29b6b2
...@@ -725,8 +725,8 @@ static void __cold _credit_init_bits(size_t bits) ...@@ -725,8 +725,8 @@ static void __cold _credit_init_bits(size_t bits)
**********************************************************************/ **********************************************************************/
static bool used_arch_random; static bool used_arch_random;
static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU); static bool trust_cpu __initdata = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU);
static bool trust_bootloader __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER); static bool trust_bootloader __initdata = IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER);
static int __init parse_trust_cpu(char *arg) static int __init parse_trust_cpu(char *arg)
{ {
return kstrtobool(arg, &trust_cpu); return kstrtobool(arg, &trust_cpu);
...@@ -865,13 +865,12 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness); ...@@ -865,13 +865,12 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
* Handle random seed passed by bootloader, and credit it if * Handle random seed passed by bootloader, and credit it if
* CONFIG_RANDOM_TRUST_BOOTLOADER is set. * CONFIG_RANDOM_TRUST_BOOTLOADER is set.
*/ */
void __cold add_bootloader_randomness(const void *buf, size_t len) void __init add_bootloader_randomness(const void *buf, size_t len)
{ {
mix_pool_bytes(buf, len); mix_pool_bytes(buf, len);
if (trust_bootloader) if (trust_bootloader)
credit_init_bits(len * 8); credit_init_bits(len * 8);
} }
EXPORT_SYMBOL_GPL(add_bootloader_randomness);
#if IS_ENABLED(CONFIG_VMGENID) #if IS_ENABLED(CONFIG_VMGENID)
static BLOCKING_NOTIFIER_HEAD(vmfork_chain); static BLOCKING_NOTIFIER_HEAD(vmfork_chain);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
struct notifier_block; struct notifier_block;
void add_device_randomness(const void *buf, size_t len); void add_device_randomness(const void *buf, size_t len);
void add_bootloader_randomness(const void *buf, size_t len); void __init add_bootloader_randomness(const void *buf, size_t len);
void add_input_randomness(unsigned int type, unsigned int code, void add_input_randomness(unsigned int type, unsigned int code,
unsigned int value) __latent_entropy; unsigned int value) __latent_entropy;
void add_interrupt_randomness(int irq) __latent_entropy; void add_interrupt_randomness(int irq) __latent_entropy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment