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 CECBE105A59F for ; Thu, 12 Mar 2026 13:46:56 +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=l8xdTzfmFI9blWnX69yppRL0CTG4tWAVHoV5RzxnJ4M=; b=PmbhtytWngpCKzbg+9vZWdlqW7 w25KHJzOUREc8SIRF82oduOMoSaqG6lwr/yjFi7hGuToMwizFvOWk2NKz+Le66D6AdhS+AIQ90bYb Kh+ilkD9wrdRBZc3xdXWYLv/fkoqb9xGUkIKzbhgIQaKZrnEnc0Su6SrpsqVETsb0yId2V6qBO8pY g6qSQDlCLwHKjjpgYefjV9mFATN2WaYcrGg5S0aWxmpwk/7GAlFj7JgExoBnaonbkatzD37b9MvM2 0+Ju9F3goGYGf7ZkaJxrYXdRh8+bsBZRvVAB57L4GGiadWW1Rt2SasCe0EEQ6dea4LY6axBcOq45x dGU/yhiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w0gNL-0000000E9bv-0x2V; Thu, 12 Mar 2026 13:46:55 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w0gNI-0000000E9bU-3dXi; Thu, 12 Mar 2026 13:46:53 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 0023060145; Thu, 12 Mar 2026 13:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0435C4CEF7; Thu, 12 Mar 2026 13:46:46 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="aNowo7eU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1773323205; 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=l8xdTzfmFI9blWnX69yppRL0CTG4tWAVHoV5RzxnJ4M=; b=aNowo7eUwaDEsiVlTqmEAkItMBfiAqnQpwNdW5+Iir3vEvTnk82QibP2d05ImlF0a165mh nmvWlvpeFzo1/3YJJgy9A68B3kA75iz0ORvDTg44s5evgsV+Q5arPoARsc9Mpj0kc03vTo y0krEtMS6grTzTv7HePJJwYz8b+7S/w= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d18605ad (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 12 Mar 2026 13:46:44 +0000 (UTC) Date: Thu, 12 Mar 2026 14:46:39 +0100 From: "Jason A. Donenfeld" To: Christoph Hellwig Cc: Andrew Morton , Richard Henderson , Matt Turner , Magnus Lindholm , Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , Andreas Larsson , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Herbert Xu , Dan Williams , Chris Mason , David Sterba , Arnd Bergmann , Song Liu , Yu Kuai , Li Nan , Theodore Ts'o , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-crypto@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-arch@vger.kernel.org, linux-raid@vger.kernel.org Subject: Re: [PATCH 26/27] random: factor out a __limit_random_u32_below helper Message-ID: References: <20260311070416.972667-1-hch@lst.de> <20260311070416.972667-27-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260311070416.972667-27-hch@lst.de> X-BeenThere: linux-um@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-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org On Wed, Mar 11, 2026 at 08:03:58AM +0100, Christoph Hellwig wrote: > Factor out the guts of __get_random_u32_below into a new helper, > so that callers with their own prng state can reuse this code. What Eric said. random.c is not "some library code" meant to be pulled apart like this. If you think there are some good general purpose arithmetic functions, by all means develop shared infrastructure in the right place. But I think for this super simple/trivial _below function, you can probably just place it additionally where you're using it, without needing to touch random.c.