Re: [PATCH 4/7] random: remove unused reserved argument
From: Dominik Brodowski
Date: Sun Jan 16 2022 - 08:45:35 EST
Am Thu, Jan 13, 2022 at 04:44:10PM +0100 schrieb Jason A. Donenfeld:
> This argument is always set to zero, as a result of us not caring about
> keeping a certain amount reserved in the pool these days. So just remove
> it and cleanup the function signatures.
>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
I'd suggest noting in the patch title and commit message that this relates
to the extract_entropy() function.
> @@ -1342,7 +1341,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
> /* never pull more than available */
> have_bytes = entropy_count >> (ENTROPY_SHIFT + 3);
>
> - if ((have_bytes -= reserved) < 0)
> + if (have_bytes < 0)
> have_bytes = 0;
> ibytes = min_t(size_t, ibytes, have_bytes);
Hmm. We already WARN_ON(entropy_count < 0) a few lines below. Maybe move
that assertion before the assignement of have_bytes? Then, have_bytes can
never be lower than zero, and the code becomes even simpler. What do you
think?
Reviewed-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Thanks,
Dominik