From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohIA1-00ENDA-TJ for linux-um@lists.infradead.org; Sat, 08 Oct 2022 22:19:12 +0000 From: David Laight Subject: RE: [PATCH v4 4/6] treewide: use get_random_u32() when possible Date: Sat, 8 Oct 2022 22:18:45 +0000 Message-ID: References: <20221007180107.216067-1-Jason@zx2c4.com> <20221007180107.216067-5-Jason@zx2c4.com> In-Reply-To: <20221007180107.216067-5-Jason@zx2c4.com> MIME-Version: 1.0 Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: "'Jason A. Donenfeld'" , "linux-kernel@vger.kernel.org" , "patches@lists.linux.dev" Cc: Andreas Noever , Andrew Morton , Andy Shevchenko , Borislav Petkov , "Catalin Marinas , =?utf-8?B?Q2hyaXN0b3BoIELDtmhtd2FsZGVy?=" , Christoph Hellwig , Christophe Leroy , Daniel Borkmann , Dave Airlie , Dave Hansen , "David S . Miller" , Eric Dumazet , Florian Westphal , "Greg Kroah-Hartman , H . Peter Anvin " , Heiko Carstens , Helge Deller , Herbert Xu , Huacai Chen , Hugh Dickins , Jakub Kicinski , "James E . J . Bottomley" , Jan Kara , Jason Gunthorpe , Jens Axboe , Johannes Berg , Jonathan Corbet , Jozsef Kadlecsik , KP Singh , Kees Cook , Marco Elver , Mauro Carvalho Chehab , "Michael Ellerman , Pablo Neira Ayuso , Paolo Abeni" , Peter Zijlstra , Richard Weinberger , Russell King , Theodore Ts'o , Thomas Bogendoerfer , Thomas Gleixner , Thomas Graf , Ulf Hansson , Vignesh Raghavendra , WANG Xuerui , Will Deacon , Yury Norov , "dri-devel@lists.freedesktop.org" , "kasan-dev@googlegroups.com" , "kernel-janitors@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-block@vger.kernel.org" , "linux-crypto@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-media@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , "linux-mmc@vger.kernel.org" , "linux-mtd@lists.infradead.org" , "linux-nvme@lists.infradead.org" , "linux-parisc@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-um@lists.infradead.org" , "linux-usb@vger.kernel.org" , "linux-wireless@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "loongarch@lists.linux.dev" , "netdev@vger.kernel.org" , "sparclinux@vger.kernel.org" , "x86@kernel.org" , =?utf-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Chuck Lever , Jan Kara , Mika Westerberg From: Jason A. Donenfeld > 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(). > ... > 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)); David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um