Re: [PATCH 1/3] random: unify early init crng load accounting

From: Eric Biggers
Date: Mon Feb 21 2022 - 00:50:44 EST


On Sun, Feb 13, 2022 at 12:10:20AM +0100, Jason A. Donenfeld wrote:
> -static size_t crng_fast_load(const void *cp, size_t len)
> +static size_t crng_pre_init_inject(const void *cp, size_t len,
> + bool fast, bool account)

This would be a good chance to rename 'cp' to something more usual, like 'in'.

Also, there's still a mention of "crng_{fast,slow}_load" in crng_make_state().

> + const u8 *src = cp;
> +
> + if (fast) {
> + if (!spin_trylock_irqsave(&base_crng.lock, flags))
> + return 0;
> + } else
> + spin_lock_irqsave(&base_crng.lock, flags);

Nit: the kernel coding style requires braces around the else clause here.

- Eric