Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2933428iog; Mon, 20 Jun 2022 07:46:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ugtRMwajbXO5lbAApYQSdXXEB5oXGLUg1/RxmolqEDkipTddhpv8x4jRLa2rxwsXO/ss6d X-Received: by 2002:a17:90b:716:b0:1ec:95da:6164 with SMTP id s22-20020a17090b071600b001ec95da6164mr10714344pjz.92.1655736411111; Mon, 20 Jun 2022 07:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736411; cv=none; d=google.com; s=arc-20160816; b=cRNT/UkJ/8KscmOgCgC33yR6QXB0CWeYkRpmHDXVjykOpreJEpstdk57cHSmYYq1VH aEjO61u+bfIzGYn3dJddfa2bKFpSNVlwVozhnhiK3CIr8WMxVltiyB5w5wD7vmE0OlWq tQNj3ZxifKBJrmh8WwNrYQGMIFORX5akAdKHqXWuzh3D659SguamOWcxGTsYZEYtAKIW 8oxzuUm0wLucBV5oB78/anCYIrGPNs0Pf5tXXcwoo/S9nFZM+TC+TRPa55IG7c4HLR7M /WIF/azERxOd6AbxIAgY/pZXshiq0jGXILT3n1kZ6BEoTZuPBi2VaW9H5zQy0cj0rHG7 T50A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7fb6IwXveE10ov+LBC4vgPQDzngusn6mJLT8a3e4img=; b=fTYA5XIhfHUYai2pmTtpJ6GAs95EzNmSXrnRUKVki26uT1NOhWuHU8kc+HL2xdxBOw 4/IjN2GiiwHO1qOr2aFJ2AaGyQ6zTfa7B4O/CHio0NX45IIZNzmQtznw0M5z17FBULSW uqHJraReoPe2XXPwS1dWYYjsNRZhbU5FD74TGrGdvsPzQE9XOux7LjVhQTn2SOH3NrT0 OKOjS97C5BDECiEjzefZgdSKh5up6WaaykCEAPDNZI/ETgBmiOGskB/3Nk9Aah216UY7 uOv9VPZHVu3tdBakBEps/JBjv3rSg62ClOfBpOnENn/HA8jWPR+vwNAbWwmuBQfEH5kl 5Qyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bxMdSyjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y65-20020a638a44000000b003fe49ec934asi6163636pgd.83.2022.06.20.07.46.38; Mon, 20 Jun 2022 07:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bxMdSyjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344982AbiFTOMY (ORCPT + 99 others); Mon, 20 Jun 2022 10:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349228AbiFTNwi (ORCPT ); Mon, 20 Jun 2022 09:52:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1453152A; Mon, 20 Jun 2022 06:19:11 -0700 (PDT) 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 22137B80E7A; Mon, 20 Jun 2022 13:13:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 739A0C3411B; Mon, 20 Jun 2022 13:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730817; bh=05oCL9/vwRD2ONushJmIq7RlXP0+bm7pgIUFoypvMaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxMdSyjQK42mAtYTU21TdRqyO8yOlgpRubuRR/+ZeZFHK+iuasSJz2pkq0LsfLnjD XGwJjdCNgcP48qXNCd2jI+rkoMchrQlDtBwaMxW9JHbZfD0+zonp5HbVfEoQUfK6n4 ZSlBZMOK/idpXphQZY+GzZRBlRYkbEGtvcQjCBi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , "Jason A. Donenfeld" Subject: [PATCH 5.4 063/240] random: access primary_pool directly rather than through pointer Date: Mon, 20 Jun 2022 14:49:24 +0200 Message-Id: <20220620124740.181296930@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124737.799371052@linuxfoundation.org> References: <20220620124737.799371052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org From: Dominik Brodowski commit ebf7606388732ecf2821ca21087e9446cb4a5b57 upstream. Both crng_initialize_primary() and crng_init_try_arch_early() are only called for the primary_pool. Accessing it directly instead of through a function parameter simplifies the code. Signed-off-by: Dominik Brodowski Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -762,7 +762,7 @@ static bool crng_init_try_arch(struct cr return arch_init; } -static bool __init crng_init_try_arch_early(struct crng_state *crng) +static bool __init crng_init_try_arch_early(void) { int i; bool arch_init = true; @@ -774,7 +774,7 @@ static bool __init crng_init_try_arch_ea rv = random_get_entropy(); arch_init = false; } - crng->state[i] ^= rv; + primary_crng.state[i] ^= rv; } return arch_init; @@ -788,16 +788,16 @@ static void crng_initialize_secondary(st crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; } -static void __init crng_initialize_primary(struct crng_state *crng) +static void __init crng_initialize_primary(void) { - _extract_entropy(&crng->state[4], sizeof(u32) * 12); - if (crng_init_try_arch_early(crng) && trust_cpu && crng_init < 2) { + _extract_entropy(&primary_crng.state[4], sizeof(u32) * 12); + if (crng_init_try_arch_early() && trust_cpu && crng_init < 2) { invalidate_batched_entropy(); numa_crng_init(); crng_init = 2; pr_notice("crng init done (trusting CPU's manufacturer)\n"); } - crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; + primary_crng.init_time = jiffies - CRNG_RESEED_INTERVAL - 1; } static void crng_finalize_init(struct crng_state *crng) @@ -1698,7 +1698,7 @@ int __init rand_initialize(void) init_std_data(); if (crng_need_final_init) crng_finalize_init(&primary_crng); - crng_initialize_primary(&primary_crng); + crng_initialize_primary(); crng_global_init_time = jiffies; if (ratelimit_disable) { urandom_warning.interval = 0;