mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Jann Horn <jannh@google.com>
Subject: Re: [PATCH v2] random: make more consistent use of integer types
Date: Sun, 20 Feb 2022 19:53:56 -0800	[thread overview]
Message-ID: <YhMM1C7n4ipZcQE3@sol.localdomain> (raw)
In-Reply-To: <20220209180507.646941-1-Jason@zx2c4.com>

This looks good in general, but a few comments below.

On Wed, Feb 09, 2022 at 07:05:07PM +0100, Jason A. Donenfeld wrote:
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Reviewed-by: Jann Horn <jannh@google.com>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> -static void _mix_pool_bytes(const void *in, int nbytes)
> +static void _mix_pool_bytes(const void *in, size_t nbytes)
>  {
>  	blake2s_update(&input_pool.hash, in, nbytes);
>  }
>  
> -static void mix_pool_bytes(const void *in, int nbytes)
> +static void mix_pool_bytes(const void *in, size_t nbytes)

The committed version of this patch removes the __mix_pool_bytes() function as
well, and it's not clear how it is related to the rest of the patch.  Perhaps
that part belongs in the patch that removes all the tracepoints?

> -static size_t crng_fast_load(const u8 *cp, size_t len)
> +static size_t crng_fast_load(const void *cp, size_t len)
>  {
>  	unsigned long flags;
> -	u8 *p;
> +	u8 *src = (u8 *)cp;

This should use 'const u8 *'.

>  int __init rand_initialize(void)
>  {
> -	int i;
> +	size_t i;
>  	ktime_t now = ktime_get_real();

This introduces an assumption that BLAKE2S_BLOCK_SIZE % sizeof(unsigned long) ==
0.  That happens to always be true, but it would be better to either not change
this, or rewrite the loop to 'i = 0; i < BLAKE2S_BLOCK_SIZE; i += sizeof(rv)'

- Eric

  parent reply	other threads:[~2022-02-21  3:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 13:52 [PATCH] " Jason A. Donenfeld
2022-02-09 18:05 ` [PATCH v2] " Jason A. Donenfeld
2022-02-09 18:56   ` Dominik Brodowski
2022-02-21  3:53   ` Eric Biggers [this message]
2022-02-21 15:04     ` Jason A. Donenfeld
2022-02-21 15:05       ` [PATCH v3] " Jason A. Donenfeld
2022-02-21 19:15         ` Eric Biggers

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=YhMM1C7n4ipZcQE3@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=jannh@google.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

all inboxes | Powered by JetHome®