Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp481336iob; Fri, 13 May 2022 06:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn4poXqXMqxrjOUZAc+OqcyK6reqX5EeSfATFM9Erh2o//j872Bmuyveh9OHhfu+52XPIP X-Received: by 2002:a17:907:1c9c:b0:6f4:2918:5672 with SMTP id nb28-20020a1709071c9c00b006f429185672mr4150272ejc.439.1652447103664; Fri, 13 May 2022 06:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652447103; cv=none; d=google.com; s=arc-20160816; b=UhnS230B9Kf/ZU2Q93/vhrK53fc+VGgtA5OpXj/+RlpCz7xkOk0whiBz10QPFXI2FM 0NR19LxsYieseE7fwooOuy+Qws8wYeKpChQiK/9oKIjH7IgcP7hhENyzCulymdiPLWPb Fe33cGUBH+RJQlw3etZuis3U2YS4CuLhR4bdQCJ8JogNWmzSmO0SsiXCRE52EX99DEp3 Ai1zwfH5nIwqQu4w7NvJVx4qTS3OY5RDgfHuPjjrzkfQX15lj5Gpd7F2VfB4Bhr8cl9X eqZeBi7Npnbsa0lPyPa4z6+r0VPZYJHwsbEe7G/KE+al3wSw+MVgdIHN3PbvtIcb7YdH r/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=3zpSScpSRCkJzf0Smy002KaJK0XPjjJ2/UA7+lZMNYs=; b=wveFiTgXgdf83O7m6M4Sf98C/EyxZRkcwkZ1sIKUZft4ln2RpVvJKoSt+fs2i0Uf3z Q0CxN8gYuiEDwIpz2iuAQXFxjlHVstee6hFgf7Wy9Y4jDdRQwRAdbHZV4qTSArDzsiA/ jpY697vqJBuR9ePd9TJGDY777mR2OjBtR2D2vhkr/t2Mz2UCASNMp8mg5z2QEJtGluXW anJNKm9SV5Evklv0WQd4H6RcJCYQUgVYIoMwMshuA+XP6SembY4P2zF2o4hBxFMLKr5b xQmGISvbJsLhdi7wbpN+Nxpaip+WYmRFz00bR5VW0bzRJVFCgDYu4ZdZWJVo5+Q1UhMc 4cWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a05640235d300b00425b57c4593si2386097edc.163.2022.05.13.06.04.23; Fri, 13 May 2022 06:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377332AbiEMG03 (ORCPT + 99 others); Fri, 13 May 2022 02:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377309AbiEMG0Y (ORCPT ); Fri, 13 May 2022 02:26:24 -0400 Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB83275CF; Thu, 12 May 2022 23:26:21 -0700 (PDT) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id F3FD0201409; Fri, 13 May 2022 06:26:05 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 18A7B80914; Fri, 13 May 2022 08:18:30 +0200 (CEST) Date: Fri, 13 May 2022 08:18:30 +0200 From: Dominik Brodowski To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH] random: credit architectural init the exact amount Message-ID: References: <20220512133835.102028-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220512133835.102028-1-Jason@zx2c4.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Am Thu, May 12, 2022 at 03:38:35PM +0200 schrieb Jason A. Donenfeld: > RDRAND and RDSEED can fail sometimes, which is fine. We currently > initialize the RNG with 512 bits of RDRAND/RDSEED. We only need 256 bits > of those to succeed in order to initialize the RNG. Instead of the > current "all or nothing" approach, actually credit these contributions > the amount that is actually contributed. > > Signed-off-by: Jason A. Donenfeld > --- > drivers/char/random.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/char/random.c b/drivers/char/random.c > index bd80d74a7f8c..9ffa41c5e092 100644 > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -934,9 +934,8 @@ static struct notifier_block pm_notifier = { .notifier_call = random_pm_notifica > */ > int __init random_init(const char *command_line) > { > - size_t i; > ktime_t now = ktime_get_real(); > - bool arch_init = true; > + unsigned int i, arch_init; Maybe s/arch_init/arch_init_cnt/g to clarify that this is now used as a counter? Otherwise, looks good: Reviewed-by: Dominik Brodowski Thanks, Dominik