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

From
Jason A. Donenfeld <Jason@zx2c4.com>
Date
2022-10-06 15:01:59
Also in
dri-devel, linux-f2fs-devel, linux-hams, linux-nvme, lvs-devel
Reply to
Kees Cook, 2022-10-06
On Wed, Oct 05, 2022 at 09:38:02PM -0700, Kees Cook wrote:
quoted
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
Thread (31 messages) 31 messages, 8 authors, last reply 2022-10-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help