[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YeQcpzxKWLuJ9Kcz@owl.dominikbrodowski.net>
Date: Sun, 16 Jan 2022 14:24:55 +0100
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-kernel@...r.kernel.org, tytso@....edu
Subject: Re: [PATCH 4/7] random: remove unused reserved argument
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@...c4.com>
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@...inikbrodowski.net>
Thanks,
Dominik
Powered by blists - more mailing lists