[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9p2v664oLNAv74H=tu3CFVwxtEUw5M9neOAred6pR3FDg@mail.gmail.com>
Date: Sat, 12 Mar 2022 16:58:06 -0700
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
"Theodore Ts'o" <tytso@....edu>
Subject: Re: [PATCH] random: make consistent usage of crng_ready()
Hi Eric,
On Sat, Mar 12, 2022 at 1:09 PM Eric Biggers <ebiggers@...nel.org> wrote:
>
> On Tue, Mar 08, 2022 at 11:25:17AM -0700, Jason A. Donenfeld wrote:
> > diff --git a/drivers/char/random.c b/drivers/char/random.c
> > index 69591d599338..e37ae7ef039c 100644
> > --- a/drivers/char/random.c
> > +++ b/drivers/char/random.c
> > @@ -123,7 +123,7 @@ static void try_to_generate_entropy(void);
> > */
> > int wait_for_random_bytes(void)
> > {
> > - if (likely(crng_ready()))
> > + if (crng_ready())
> > return 0;
> >
> > do {
> ...
> > } while (!crng_ready());
>
> I guess the reason why the above doesn't simply use a 'while' loop is because
> someone wanted 'likely()' on the first crng_ready()? That doesn't actually
> apply, since crng_ready() has likely() itself, it should just be a 'while' loop.
Nice catch, thanks.
Jason
Powered by blists - more mailing lists