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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31C40C433FE for ; Thu, 6 Oct 2022 15:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0ENsN90teNsuQpmekN7b+hdYLbg48hC1jdG1eR+cyBQ=; b=vCgeLwB4nLys7kEdJiy1S7Oepe f86NOqYec+2EPwjz2D7nU4ebB3xXhtC74PwZ+ugY+oTrP88jgP/AvGHa+ZNJeAyFOU6Mg0gqcY3LM 22OSi1Ma9DLVKgd0RbOnwHZFwX/SI4vF6KE0HBAiKG/uuWPUq6D9BV3qhh28CqnsMdeuLPyWOPes9 tE27JoOwMY4LzTQjSFfFvgNIGYcttES2mDXVTUczsLuX99jGgMdngnDTnS9OyTwSbLV965xUXgWb+ nHx7edt0lktjxmNxDo/XBk8wdbin19UPh3ocIyAKRAnUAMgHGDdJZJAG88Qg/1dV+KriLYPMBfRrg y1tYv6dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogSOe-003CQM-Bt; Thu, 06 Oct 2022 15:02:48 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogQZb-002WeS-5p; Thu, 06 Oct 2022 13:06:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665061559; x=1696597559; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=FGTLdaiXSBCapn2JjYMa8Pm3byrwndmRCKrokbx26S8=; b=k0VxN2CUddDkOjizs4TP4N7jytwzUt44QuTUvwLzER1gqZHQ1v6ocZIM BkZv1bDIQzW/a89qvQCtHU7mvHx8GCe12navTH0iUbcLPCvzRFK1gblfr 0z98UvJyTcPO0W9SBj3O8EUCZdZAY5aYXoMXoNdKDns2w8MHafzIn/ZQc gcdmNAHZHNPfCERh/ZBdtwLjzgjJ4qJT7oZSCjMifS5a3CGHGnF7CZQng imtAPtvqwgwPGdPZ/xyI2QtUdunoydlF0ti/RHRPvOmelMaEMY2ChBWaP uNr0XJyQxzS9896bwDYgOlHzw9cLHp0NmDiICoyrfyVjYgZIsj5ABoLbp g==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="301036980" X-IronPort-AV: E=Sophos;i="5.95,163,1661842800"; d="scan'208";a="301036980" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2022 06:05:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="575816142" X-IronPort-AV: E=Sophos;i="5.95,163,1661842800"; d="scan'208";a="575816142" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 06 Oct 2022 06:05:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1ogQZ0-0039VB-0C; Thu, 06 Oct 2022 16:05:22 +0300 Date: Thu, 6 Oct 2022 16:05:21 +0300 From: Andy Shevchenko To: Jason Gunthorpe Cc: "Jason A. Donenfeld" , Kees Cook , linux-kernel@vger.kernel.org, Ajay Singh , Akinobu Mita , Alexandre Torgue , Amitkumar Karwar , Andreas Dilger , Andreas =?iso-8859-1?Q?F=E4rber?= , Andreas Noever , Andrew Lunn , Andrew Morton , Andrii Nakryiko , Andy Gospodarek , Andy Lutomirski , Anil S Keshavamurthy , Anna Schumaker , Arend van Spriel , Ayush Sawal , Borislav Petkov , Chao Yu , Christoph =?iso-8859-1?Q?B=F6hmwalder?= , Christoph Hellwig , Christophe Leroy , Chuck Lever , Claudiu Beznea , Cong Wang , Dan Williams , Daniel Borkmann , "Darrick J . Wong" , Dave Hansen , David Ahern , "David S . Miller" , Dennis Dalessandro , Dick Kennedy , Dmitry Vyukov , Eric Dumazet , Florian Westphal , Franky Lin , Ganapathi Bhat , Greg Kroah-Hartman , Gregory Greenman , "H . Peter Anvin" , Hannes Reinecke , Hans Verkuil , Hante Meuleman , Hao Luo , Haoyue Xu , Heiner Kallweit , Helge Deller , Herbert Xu , Hideaki YOSHIFUJI , Hugh Dickins , Igor Mitsyanko , Ilya Dryomov , Ingo Molnar , Jack Wang , Jaegeuk Kim , Jaehoon Chung , Jakub Kicinski , Jamal Hadi Salim , "James E . J . Bottomley" , James Smart , Jan Kara , Jay Vosburgh , Jean-Paul Roubelat , Jeff Layton , Jens Axboe , Jiri Olsa , Jiri Pirko , Johannes Berg , John Fastabend , John Stultz , Jon Maloy , Jonathan Corbet , Jozsef Kadlecsik , Julian Anastasov , KP Singh , Kalle Valo , Keith Busch , Lars Ellenberg , Leon Romanovsky , Manish Rangankar , Manivannan Sadhasivam , Marcelo Ricardo Leitner , Marco Elver , "Martin K . Petersen" , Martin KaFai Lau , Masami Hiramatsu , Mauro Carvalho Chehab , Maxime Coquelin , "Md . Haris Iqbal" , Michael Chan , Michael Ellerman , Michael Jamet , Michal Januszewski , Mika Westerberg , Miquel Raynal , Namjae Jeon , "Naveen N . Rao" , Neil Horman , Nicholas Piggin , Nilesh Javali , OGAWA Hirofumi , Pablo Neira Ayuso , Paolo Abeni , Peter Zijlstra , Philipp Reisner , Potnuri Bharat Teja , Pravin B Shelar , Rasmus Villemoes , Richard Weinberger , Rohit Maheshwari , Russell King , Sagi Grimberg , Santosh Shilimkar , Sergey Matyukevich , Sharvari Harisangam , Simon Horman , Song Liu , Stanislav Fomichev , Steffen Klassert , Stephen Boyd , Stephen Hemminger , Sungjong Seo , Theodore Ts'o , Thomas Gleixner , Thomas Graf , Thomas Sailer , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Trond Myklebust , Ulf Hansson , Varun Prakash , Veaceslav Falico , Vignesh Raghavendra , Vinay Kumar Yadav , Vinod Koul , Vlad Yasevich , Wenpeng Liang , Xinming Hu , Xiubo Li , Yehezkel Bernat , Ying Xue , Yishai Hadas , Yonghong Song , Yury Norov , brcm80211-dev-list.pdl@broadcom.com, cake@lists.bufferbloat.net, ceph-devel@vger.kernel.org, coreteam@netfilter.org, dccp@vger.kernel.org, dev@openvswitch.org, dmaengine@vger.kernel.org, drbd-dev@lists.linbit.com, dri-devel@lists.freedesktop.org, kasan-dev@googlegroups.com, linux-actions@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-hams@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-nvme@lists.infradead.org, linux-raid@vger.kernel.org, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org, linux-sctp@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, linux-xfs@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, lvs-devel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, rds-devel@oss.oracle.com, SHA-cyfmac-dev-list@infineon.com, target-devel@vger.kernel.org, tipc-discussion@lists.sourceforge.net Subject: Re: [PATCH v1 1/5] treewide: use prandom_u32_max() when possible Message-ID: References: <20221005214844.2699-1-Jason@zx2c4.com> <20221005214844.2699-2-Jason@zx2c4.com> <202210052035.A1020E3@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_060559_266626_0240B3D2 X-CRM114-Status: GOOD ( 30.99 ) X-Mailman-Approved-At: Thu, 06 Oct 2022 08:01:47 -0700 X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Thu, Oct 06, 2022 at 09:55:19AM -0300, Jason Gunthorpe wrote: > On Thu, Oct 06, 2022 at 06:45:25AM -0600, Jason A. Donenfeld wrote: > > On Wed, Oct 05, 2022 at 09:16:50PM -0700, Kees Cook wrote: > > > On Wed, Oct 05, 2022 at 11:48:40PM +0200, Jason A. Donenfeld wrote: > > > > Rather than incurring a division or requesting too many random bytes for > > > > the given range, use the prandom_u32_max() function, which only takes > > > > the minimum required bytes from the RNG and avoids divisions. > > > > > > Yes please! > > > > > > Since this is a treewide patch, it's helpful for (me at least) doing > > > reviews to detail the mechanism of the transformation. > > > > This is hand done. There were also various wrong seds done. And then I'd > > edit the .diff manually, and then reapply it, as an iterative process. > > No internet on the airplane, and oddly no spatch already on my laptop (I > > think I had some Gentoo ocaml issues at some point and removed it?). > > > > > e.g. I imagine this could be done with something like Coccinelle and > > > > Feel free to check the work here by using Coccinelle if you're into > > that. > > Generally these series are a lot easier to review if it is structured > as a patches doing all the unusual stuff that had to be by hand > followed by an unmodified Coccinelle/sed/etc handling the simple > stuff. > > Especially stuff that is reworking the logic beyond simple > substitution should be one patch per subsystem not rolled into a giant > one patch conversion. > > This makes the whole workflow better because the hand-done stuff can > have a chance to flow through subsystem trees. +1 to all arguments for the splitting. I looked a bit into the code I have the interest to, but I won't spam people with not-so-important questions / comments / tags, etc. -- With Best Regards, Andy Shevchenko