From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24467C433FE for ; Sat, 8 Oct 2022 22:37:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D0B56B0071; Sat, 8 Oct 2022 18:37:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 558C96B0073; Sat, 8 Oct 2022 18:37:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AB5E6B0074; Sat, 8 Oct 2022 18:37:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 227876B0071 for ; Sat, 8 Oct 2022 18:37:44 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E799416079F for ; Sat, 8 Oct 2022 22:37:43 +0000 (UTC) X-FDA: 79999245606.20.6D92A2C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 8813712002B for ; Sat, 8 Oct 2022 22:37:43 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69DE260B14; Sat, 8 Oct 2022 22:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DFC7C433C1; Sat, 8 Oct 2022 22:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1665268654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KIVWIkgHNJFfTR3APACYr63A/xqCM59y71KVcO4sCaY=; b=XGhFZP09vIl+/5CeKrUwcn8D5G2fzzZUueDyYoC0ioAptMgCsgW2Y/nAMxGX3+Jlr3Pqzf DPqqLFSnwZy5zrGQ0qIoQsckZXAODZVAUr3JPUklU2lLbHkSxIaLy6qBIDsRl1J6fqnfqB i4V7yDQrjT6b8E+OkiJdDj+99/oMH4o= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c941732b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 8 Oct 2022 22:37:33 +0000 (UTC) Date: Sun, 9 Oct 2022 00:37:33 +0200 From: "Jason A. Donenfeld" To: David Laight Cc: "linux-kernel@vger.kernel.org" , "patches@lists.linux.dev" , Andreas Noever , Andrew Morton , Andy Shevchenko , Borislav Petkov , Catalin Marinas , Christoph =?utf-8?Q?B=C3=B6hmwalder?= , 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" , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Chuck Lever , Jan Kara , Mika Westerberg Subject: Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible Message-ID: References: <20221007180107.216067-1-Jason@zx2c4.com> <20221007180107.216067-5-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665268663; a=rsa-sha256; cv=none; b=4HrjfU6lnLGHK/3DmhjEI8z6ppxbDlq92SBsj+8Ji5gy4Lea43B4LavJMAkcasa2b44dFr /3vOx6qrdoKTz6oaDe51XPnp4rKCbcW/cZuGIN5WGx16IIydVcihbdhUdXnslL6BxYLTYH k6TJ3QE4gfe2snJCE7tPud4hCDEpJnY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=XGhFZP09; dmarc=pass (policy=quarantine) header.from=zx2c4.com; spf=pass (imf29.hostedemail.com: domain of "SRS0=1Ou5=2J=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=1Ou5=2J=zx2c4.com=Jason@kernel.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665268663; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KIVWIkgHNJFfTR3APACYr63A/xqCM59y71KVcO4sCaY=; b=GaYuZ9TXEc+2uaBP+XWq107woaakp71839CFVeW+IKRHCnWHBMi7j/ylqrLm64csbPBfXh YXNdgaO4GkIZ2ji7kcLMIPQllMLANhkvNV20ltGuQJHOfzHLPmPVIQ3oVQud5nVElOE3s7 8pbHvfIkMabl4+fwSpi4lhabVZc9NBg= X-Stat-Signature: ppt4xxkp7s8ptnmhwm3whbd7zf13pamj X-Rspamd-Queue-Id: 8813712002B Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=XGhFZP09; dmarc=pass (policy=quarantine) header.from=zx2c4.com; spf=pass (imf29.hostedemail.com: domain of "SRS0=1Ou5=2J=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=1Ou5=2J=zx2c4.com=Jason@kernel.org" X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1665268663-139686 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Oct 08, 2022 at 10:18:45PM +0000, David Laight wrote: > 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)); 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)