Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1341367rwl; Thu, 10 Aug 2023 09:43:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOT8yyt26st6kblV8StvLMRW8KNBMrg4KNtskLdLd7okPkF/7zowuccQ14YIs7wrWgy2L9 X-Received: by 2002:ac2:4ed1:0:b0:4fe:ecd:4950 with SMTP id p17-20020ac24ed1000000b004fe0ecd4950mr1959596lfr.1.1691685787588; Thu, 10 Aug 2023 09:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691685787; cv=none; d=google.com; s=arc-20160816; b=DJ9a4hNHJgyHrgagDg/gDzZgkorNtFdWvCJBR4QNl3S7egXJDwudrgr2QbpHHZ/OV/ WqBRVagAGUnNddX+4QNviAmwxrT8U22Vr9eR4ZWgF7RCfYhmrq0h5mOPYiOC0ZUqjGEo 2DSLAro/7HtIfPsAuUOdq4Okdd/kNUKO3KXgHCk9BmZ5bhV60jOvF5yvak4XR8Jn9ydN iBc4SWRJROeCQQPP4Lea2JfpuK3LtXo2yxE4UuztgY5aR6TJx0kDkF2tRl1NyLVL4Grg 981qJHoGnZh3/+l7rYC6wOu6yMc6DW8L5hagn8zkGWBPGLkEDZFRgKSW7IC7FicWkSqC iWPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from:subject :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=vhpO4EVyYnRoAehGNwkXj+t+nWxuU381x9eNN8KrRpo=; fh=i+rym7TfmW939+Ce4EqO5ePQnSiVyVPVmXlVXQtvJxE=; b=qKkayR6ZyBa1KlQqhcRNcyzaW+7g27JjTMIiAga2j4Hk7peI75QCNjb/9Xt2kyRdy7 jpaQuZpnra7a1oN7sfgetSsSrbPw/CcQMYPL8XbeAopxomAQQkVYOPaHqgGfnc6WN2gK t7fMMPj3603r1xRxV4UvOckKeXPwbXrk1vEwccC2eAHJ46DeXJdGKAtVAC17jUL5WQ2i b7jrQgtst9hWKiCdugr5mKYKxZkQNEzo0Z1jdXYqdfukrAOfDB2/w5Qu3THHKZ6Hn4VB VWHmodRExRigB2O5PKM28IVqDa8t7qMYwRof/L2Q13fUCztIpP6YPrXHrblXt9JM98BS LRIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqQ66ydZ; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br20-20020a170906d15400b00993cdec0182si1760662ejb.143.2023.08.10.09.42.41; Thu, 10 Aug 2023 09:43:07 -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=@kernel.org header.s=k20201202 header.b=bqQ66ydZ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235648AbjHJPiw (ORCPT + 99 others); Thu, 10 Aug 2023 11:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234282AbjHJPiv (ORCPT ); Thu, 10 Aug 2023 11:38:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2655E125; Thu, 10 Aug 2023 08:38:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B90F166064; Thu, 10 Aug 2023 15:38:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1DB7C433C8; Thu, 10 Aug 2023 15:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691681929; bh=xnhTYpWPIFOHSG3sk7givZEYBgSpBgHnBgsNcE+4edw=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=bqQ66ydZ97kMwJSbyiqdJXhdFJImIqG1tDWd2g0EI+CMMAa6fEZba1i0OVQbv/h2S jXwC+xUG6l7x3FPFotosyygXgry40zyrgpKF8CxO9XxDKhm+1wC1MRmJ9IPkwiHxPT tbKLI991PilX3gXXVPNurkACT6n3xSkD6g5WqfLv8EmYERYfkUNqr15XxgyiGd8KIu wj0HXAmoYdwqN5fTeoinZlT9oZY5TXxbAhyFLSSe11vhcC13uMoN2cPKiOu7iR7Fnf LFEJzjSy1uq++EY9nul1ZmFZ+7cGFQZxgRbQnD6QyM2UxgxmP8Gi6hvGelObSjK17e 3m+X18AH1x19A== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 10 Aug 2023 18:38:39 +0300 Message-Id: Subject: Re: [PATCH v2 3/6] integrity: remove global variable from machine_keyring.c From: "Jarkko Sakkinen" To: "Nayna Jain" , Cc: "Mimi Zohar" , "Eric Snowberg" , "Paul Moore" , "linuxppc-dev" , , X-Mailer: aerc 0.15.2 References: <20230809195315.1085656-1-nayna@linux.ibm.com> <20230809195315.1085656-4-nayna@linux.ibm.com> In-Reply-To: <20230809195315.1085656-4-nayna@linux.ibm.com> X-Spam-Status: No, score=-7.1 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 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 On Wed Aug 9, 2023 at 10:53 PM EEST, Nayna Jain wrote: > trust_mok variable is accessed within a single function locally. > > Change trust_mok from global to local static variable. > > Signed-off-by: Nayna Jain > Reviewed-and-tested-by: Mimi Zohar > --- > security/integrity/platform_certs/machine_keyring.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/security/integrity/platform_certs/machine_keyring.c b/securi= ty/integrity/platform_certs/machine_keyring.c > index 389a6e7c9245..9482e16cb2ca 100644 > --- a/security/integrity/platform_certs/machine_keyring.c > +++ b/security/integrity/platform_certs/machine_keyring.c > @@ -8,8 +8,6 @@ > #include > #include "../integrity.h" > =20 > -static bool trust_mok; > - > static __init int machine_keyring_init(void) > { > int rc; > @@ -65,9 +63,11 @@ static __init bool uefi_check_trust_mok_keys(void) > bool __init trust_moklist(void) > { > static bool initialized; > + static bool trust_mok; > =20 > if (!initialized) { > initialized =3D true; > + trust_mok =3D false; > =20 > if (uefi_check_trust_mok_keys()) > trust_mok =3D true; Nice catch. Reviewed-by: Jarkko Sakkinen BR, Jarkko