lkml.org 
[lkml]   [2022]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] random: make consistent usage of crng_ready()
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.

- Eric

\
 
 \ /
  Last update: 2022-03-12 21:10    [W:0.057 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site