[PATCH v1 2/5] treewide: use get_random_{u8,u16}() when possible

Jason A. Donenfeld Jason at zx2c4.com
Thu Oct 6 05:28:26 PDT 2022


On Wed, Oct 05, 2022 at 09:38:02PM -0700, Kees Cook wrote:
> > diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
> > index 56ffaa8dd3f6..0131ed2cd1bd 100644
> > --- a/lib/test_vmalloc.c
> > +++ b/lib/test_vmalloc.c
> > @@ -80,7 +80,7 @@ static int random_size_align_alloc_test(void)
> >  	int i;
> >  
> >  	for (i = 0; i < test_loop_count; i++) {
> > -		rnd = prandom_u32();
> > +		rnd = get_random_u8();
> >  
> >  		/*
> >  		 * Maximum 1024 pages, if PAGE_SIZE is 4096.
> 
> This wasn't obvious either, but it looks like it's because it never
> consumes more than u8?

Right. The only uses of that are %23 and %10 later on down.

Jason



More information about the Linux-nvme mailing list