Messages in this thread | | | From | "Jason A. Donenfeld" <> | Date | Mon, 21 Feb 2022 16:04:06 +0100 | Subject | Re: [PATCH v2] random: make more consistent use of integer types |
| |
On Mon, Feb 21, 2022 at 4:54 AM Eric Biggers <ebiggers@kernel.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
| |