lkml.org 
[lkml]   [2022]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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

\
 
 \ /
  Last update: 2022-02-21 19:22    [W:0.073 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site