[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9o5XzZVQUKBkS7d30AwVvPX3weyHdBsUBOK7fKaQO0JMA@mail.gmail.com>
Date: Mon, 21 Feb 2022 16:04:06 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
"Theodore Ts'o" <tytso@....edu>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH v2] random: make more consistent use of integer types
On Mon, Feb 21, 2022 at 4:54 AM Eric Biggers <ebiggers@...nel.org> wrote:
> > -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 *'.
Will fix.
>
> > 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)'
Good idea; I'll rewrite the loop. That always bothered me too.
Jason
Powered by blists - more mailing lists