lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yiz98wP1hiPR5Azm@sol.localdomain>
Date:   Sat, 12 Mar 2022 12:09:23 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     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()

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ