Thread (21 messages) 21 messages, 5 authors, 2022-10-09

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2022-10-08 22:37:47
Also in: dri-devel, kernel-janitors, linux-block, linux-crypto, linux-doc, linux-fsdevel, linux-media, linux-mips, linux-mm, linux-mmc, linux-nvme, linux-patches, linux-rdma, linux-s390, linux-um, linux-usb, linux-wireless, linuxppc-dev, lkml, loongarch, sparclinux

On Sat, Oct 08, 2022 at 10:18:45PM +0000, David Laight wrote:
From: Jason A. Donenfeld
quoted
Sent: 07 October 2022 19:01

The prandom_u32() function has been a deprecated inline wrapper around
get_random_u32() for several releases now, and compiles down to the
exact same code. Replace the deprecated wrapper with a direct call to
the real function. The same also applies to get_random_int(), which is
just a wrapper around get_random_u32().
...
quoted
diff --git a/net/802/garp.c b/net/802/garp.c
index f6012f8e59f0..c1bb67e25430 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -407,7 +407,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
 {
 	unsigned long delay;

-	delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
+	delay = (u64)msecs_to_jiffies(garp_join_time) * get_random_u32() >> 32;
 	mod_timer(&app->join_timer, jiffies + delay);
 }
diff --git a/net/802/mrp.c b/net/802/mrp.c
index 35e04cc5390c..3e9fe9f5d9bf 100644
--- a/net/802/mrp.c
+++ b/net/802/mrp.c
@@ -592,7 +592,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app)
 {
 	unsigned long delay;

-	delay = (u64)msecs_to_jiffies(mrp_join_time) * prandom_u32() >> 32;
+	delay = (u64)msecs_to_jiffies(mrp_join_time) * get_random_u32() >> 32;
 	mod_timer(&app->join_timer, jiffies + delay);
 }
Aren't those:
	delay = prandom_u32_max(msecs_to_jiffies(xxx_join_time));
Probably, but too involved and peculiar for this cleanup.

Feel free to send a particular patch to that maintainer.
	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help