Messages in this thread |  | | From | "Jason A. Donenfeld" <> | Date | Sat, 12 Mar 2022 16:58:06 -0700 | Subject | Re: [PATCH] random: make consistent usage of crng_ready() |
| |
Hi Eric,
On Sat, Mar 12, 2022 at 1:09 PM Eric Biggers <ebiggers@kernel.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
|  |