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 92122C433FE for ; Thu, 17 Nov 2022 22:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rCgZRjJ66hHImOULz2y31VPnKPaYP3WHCTEF3ReCOrU=; b=frFfEAumXjszPm lsud5WdEkIxhSxVO3ZUQuUYo++eq8NJ/pVofFCZF94SrGqYVZLpfU9Y8rRIAy4b6rGqBLiUFTU/P0 mfZ6vatFj3tm22kVriGC3DZ/xkOQ+X2PVI+/0HF6g+H52uPsGKBjT4qamLsDv4ushHtGLjnBj+B1J OfmxRUqyo9ej3syqJdT3VA3EGfk6XxPCOD9GTQhtUaydQA6j1Y4BU5uEfLlZdxsleoXmiaOzqikRq CBVOdvohR6JHs0Ih+YLVZQHUcHEtESbQpLBVjb8OfoEVAlJJzJiT0w8M6712VF7g5rZssi/11qUuB fHszQlhk94sD9dpKWg1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovn6E-000FDK-Jq; Thu, 17 Nov 2022 22:11:10 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovn67-000FAY-O2 for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 22:11:08 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 069D3B82208; Thu, 17 Nov 2022 22:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D29BC433C1; Thu, 17 Nov 2022 22:10:57 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Q4bD/XUA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1668723055; 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=vJhj9Z3si41Okh7QjFL8sfRqIMi0Yk5+ouF0KwmQggU=; b=Q4bD/XUAYdzoxgYLg+XIn4Lk+1x+8orB3IGL4+URLKCwS8OvQEFHtcJHobQ1IjE5hZQeq5 VnSTrX5zHZ2fE16n1KLU+eanYkc3vTgMFIfA+ELQ9AAw9UvTlkFM7FU8Z1ElmoQ046TyID RHhzi0IVhFVn9STyoQTnIxbYkGv6Iw8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 1cf8d90d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 17 Nov 2022 22:10:54 +0000 (UTC) Date: Thu, 17 Nov 2022 23:10:50 +0100 From: "Jason A. Donenfeld" To: Kees Cook Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Greg Kroah-Hartman , Jakub Kicinski , Russell King , Catalin Marinas , Thomas Bogendoerfer , Heiko Carstens , Herbert Xu , Christoph =?utf-8?Q?B=C3=B6hmwalder?= , Jani Nikula , Jason Gunthorpe , Sakari Ailus , "Martin K . Petersen" , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , Richard Weinberger , "Darrick J . Wong" , SeongJae Park , Thomas Gleixner , Andrew Morton , Michael Ellerman , Helge Deller , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mmc@vger.kernel.org, linux-parisc@vger.kernel.org Subject: Re: [PATCH v3 3/3] treewide: use get_random_u32_inclusive() when possible Message-ID: References: <20221114164558.1180362-1-Jason@zx2c4.com> <20221117202906.2312482-1-Jason@zx2c4.com> <20221117202906.2312482-4-Jason@zx2c4.com> <202211171349.F42BA5B0@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202211171349.F42BA5B0@keescook> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_141104_226291_2087C1FF X-CRM114-Status: GOOD ( 14.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list 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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 17, 2022 at 01:57:13PM -0800, Kees Cook wrote: > The only comment I have is that maybe these cases can just be left as-is > with _below()? > > > - size_t len = get_random_u32_below(rs) + gs; > > + size_t len = get_random_u32_inclusive(gs, rs + gs - 1); > > It seems like writing it in the form of base plus [0, limit) is clearer? > > size_t len = gs + get_random_u32_below(rs); > > But there is only a handful, so *shrug* Okay, I'll drop that one. Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel