public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] random: make consistent usage of crng_ready()
Date: Sat, 12 Mar 2022 12:09:23 -0800	[thread overview]
Message-ID: <Yiz98wP1hiPR5Azm@sol.localdomain> (raw)
In-Reply-To: <20220308182517.273662-1-Jason@zx2c4.com>

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

  reply	other threads:[~2022-03-12 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 18:25 [PATCH] random: make consistent usage of crng_ready() Jason A. Donenfeld
2022-03-12 20:09 ` Eric Biggers [this message]
2022-03-12 23:58   ` Jason A. Donenfeld
2022-03-13  0:00     ` [PATCH v2] " Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yiz98wP1hiPR5Azm@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox