[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 4.19 034/234] random: avoid warnings for !CONFIG_NUMA builds
    From: Mark Rutland <>

    commit ab9a7e27044b87ff2be47b8f8e095400e7fccc44 upstream.

    As crng_initialize_secondary() is only called by do_numa_crng_init(),
    and the latter is under ifdeffery for CONFIG_NUMA, when CONFIG_NUMA is
    not selected the compiler will warn that the former is unused:

    | drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
    | 820 | static void crng_initialize_secondary(struct crng_state *crng)
    | | ^~~~~~~~~~~~~~~~~~~~~~~~~

    Stephen reports that this happens for x86_64 noallconfig builds.

    We could move crng_initialize_secondary() and crng_init_try_arch() under
    the CONFIG_NUMA ifdeffery, but this has the unfortunate property of
    separating them from crng_initialize_primary() and
    crng_init_try_arch_early() respectively. Instead, let's mark
    crng_initialize_secondary() as __maybe_unused.

    Fixes: 5cbe0f13b51a ("random: split primary/secondary crng init paths")
    Reported-by: Stephen Rothwell <>
    Signed-off-by: Mark Rutland <>
    Cc: Theodore Ts'o <>
    Signed-off-by: Theodore Ts'o <>
    Signed-off-by: Jason A. Donenfeld <>
    Signed-off-by: Greg Kroah-Hartman <>
    drivers/char/random.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/char/random.c
    +++ b/drivers/char/random.c
    @@ -801,7 +801,7 @@ static bool crng_init_try_arch(struct cr
    return arch_init;

    -static void crng_initialize_secondary(struct crng_state *crng)
    +static void __maybe_unused crng_initialize_secondary(struct crng_state *crng)
    memcpy(&crng->state[0], "expand 32-byte k", 16);
    _get_random_bytes(&crng->state[4], sizeof(__u32) * 12);

     \ /
      Last update: 2022-06-23 20:03    [W:4.585 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site