Re: [PATCH 4/7] random: remove unused reserved argument
From: Dominik Brodowski
Date: Mon Jan 17 2022 - 12:35:10 EST
Am Sun, Jan 16, 2022 at 05:22:32PM +0100 schrieb Jason A. Donenfeld:
> On Sun, Jan 16, 2022 at 2:45 PM Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > @@ -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?
>
> Can you send a separate patch for this that we can apply on top? It
> seems reasonable anyhow. Something like:
As you've written that patch yourself now, just take that, and feel free to
add my Reviewed-by tag.
Thanks,
Dominik