From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jason A. Donenfeld via dev" Subject: Re: [PATCH v1 2/5] treewide: use get_random_{u8, u16}() when possible Date: Thu, 6 Oct 2022 06:28:26 -0600 Message-ID: References: <20221005214844.2699-1-Jason@zx2c4.com> <20221005214844.2699-3-Jason@zx2c4.com> <202210052126.B34A2C62@keescook> Reply-To: "Jason A. Donenfeld" Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3DA5D6102C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5DCC160E2A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DF27D60E4C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BD8A660E2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1665059318; 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=5CT4nH/m4137cke6a9HxB/7vcArAWSQRa4usYkfKNrg=; b=OS8t32IGu3oCxKhFrKsoTlJdA0ilidFXzfDav1WbEMtetkdGq8zG44OTpAoolbKblRE28x JavSPZ213Zn0QlCC7qiV7HVuoj014/Af3MYIJXK6V6JzJ66H365IrRZBlUnLH9HyqJISSh i7WOLg4+btGeRh3RwCHT+vvVoWgXHqc= Content-Disposition: inline In-Reply-To: <202210052126.B34A2C62@keescook> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Sender: "dev" To: Kees Cook Cc: Andrew Lunn , "Darrick J . Wong" , Ulf Hansson , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Andrii Nakryiko , Hans Verkuil , linux-sctp-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Md . Haris Iqbal" , Miquel Raynal , Christoph Hellwig , Andy Gospodarek , Sergey Matyukevich , Rohit Maheshwari , Michael Ellerman , ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Christophe Leroy , Jozsef Kadlecsik , Nilesh Javali , Jean-Paul Roubelat , Dick Kennedy , Jay Vosburgh , Potnuri Bharat Teja , Vinay Kumar Yadav , linux-nfs@vg On Wed, Oct 05, 2022 at 09:38:02PM -0700, Kees Cook wrote: > > 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