From patchwork Sun Aug 13 02:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nayna Jain X-Patchwork-Id: 135008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2061894vqi; Sat, 12 Aug 2023 23:55:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYsP70x7H+h8i/wryjA9GWAwJpyoeyZX1Ni2IAqPWXnAuKvoC1Y3y8/sDKgyzuNTobPa89 X-Received: by 2002:a17:906:2921:b0:99c:da06:bca with SMTP id v1-20020a170906292100b0099cda060bcamr5060116ejd.4.1691909732902; Sat, 12 Aug 2023 23:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691909732; cv=none; d=google.com; s=arc-20160816; b=Wcq8xvIT8DoaqxydpYghPoPXTYjiJmijUJRW85fGOnxkF/abZpjRIu4kMyJr7H5pmp TDt84dwo8UkDdT0WbiVSoGag7+7SmeLwHr9q9+WQEhjshchb015YSU/5dQAq+OOT9hac QCXRgcEcWC8JuGLwLYpd0I7AtaEZFRKeaeJHnJbJXDHn+/HPU5ezEVrC7vDidlCOu2Sn 8LtKmyxtyh0+m7DEkvQuQwkzRf0lv1IdxktjYGcf4IwlE9t2yZ+EX4TgTIEcLvLAdluk Kou3sqEU9j2WBfWd2Od5OKyZiQl2o1rEERcwB3Q0d+IYm9bpVz0oMbvwbeQ5OB/TfgW2 h19g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M/sQfVzrC8d2QZrImPRGkYy/MfrT1TGVavwMdGxuas8=; fh=0HZxfkAJyx3Soo8VtDkZ0DPjkqS1NGJP1dkSl6x0XCg=; b=hh61a9UvJYA6u0JqYLuCXbu8D9vH0mcd9+RScskhvJiK6v+sSJ/XeuBJNtzpv8Ik8J dQnsuLyAP7IYQ+ppgO9GpLrfkyhSo0NMyO+VivaOjknaEEb3j1nKuoh2KWeZCgW7JNoG /wt6aKstuF49YJv3fefWNStyaCfeasVLLLbU++Ceb+AWDBKGYjDwassAs+LJYZYpsS8E 4OsbO8wW5TCqeL2ThUVlZFFGiCm4Gqz4nflW+jueycOfhSI4W+Yshq4HyYOwug2kI/pc IOvGMxJc8MOC6xB5zlhA88nJWLPgL37qsQin/NjFp4woLiGIwrcoMb+5dIpHWi3oyPgq 6ONQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Nnxewv6U; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020a17090633d600b00992d26308c0si5764215eja.538.2023.08.12.23.55.09; Sat, 12 Aug 2023 23:55:32 -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=@ibm.com header.s=pp1 header.b=Nnxewv6U; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjHMCQK (ORCPT + 99 others); Sat, 12 Aug 2023 22:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjHMCQA (ORCPT ); Sat, 12 Aug 2023 22:16:00 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E54AD7; Sat, 12 Aug 2023 19:16:03 -0700 (PDT) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37D1vaP5031051; Sun, 13 Aug 2023 02:15:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=M/sQfVzrC8d2QZrImPRGkYy/MfrT1TGVavwMdGxuas8=; b=Nnxewv6U97hNjNYX0MRQiDDB3SbFX7x+Nny4wJAbb1nd4Kczn60JywIRdJTdlcUqhayS Y9GywYiSxjfzjgWHnAVN5jGv5cLKlmcsBAH7n3pL9yMn2T1ote2S8JJD5Yniueg4Nh6I kraFbxn39SYUemlW3uRxS5/GO2LAFNsK/yR4A91MCCSWP50OTtGmbJw3UN3s83pljhyG h6xFRb+R/PdePtbC/f6FrIFL0F8SuKCLn0aZssiz+hSOK8hobQAdqhmLzkeCkv4VEi/t R6GWS8CbXHmk+l9XEnfcu3k8tPmukPkqMC9jVfpyYHuPCNxY7x5yeUoxRydyPTcN6lKq 6Q== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3senyjgaq1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 13 Aug 2023 02:15:53 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 37D11mDl023275; Sun, 13 Aug 2023 02:15:53 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3se2wpffdu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 13 Aug 2023 02:15:52 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 37D2Fl1U11272716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 13 Aug 2023 02:15:47 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EE7420040; Sun, 13 Aug 2023 02:15:47 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 45B4F20043; Sun, 13 Aug 2023 02:15:45 +0000 (GMT) Received: from li-4b5937cc-25c4-11b2-a85c-cea3a66903e4.ibm.com (unknown [9.61.3.84]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 13 Aug 2023 02:15:44 +0000 (GMT) From: Nayna Jain To: linux-integrity@vger.kernel.org Cc: Mimi Zohar , Jarkko Sakkinen , Eric Snowberg , Paul Moore , linux-security-module@vger.kernel.org, linuxppc-dev , linux-kernel@vger.kernel.org, Nayna Jain Subject: [PATCH v3 3/6] integrity: remove global variable from machine_keyring.c Date: Sat, 12 Aug 2023 22:15:28 -0400 Message-Id: <20230813021531.1382815-4-nayna@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230813021531.1382815-1-nayna@linux.ibm.com> References: <20230813021531.1382815-1-nayna@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: O_m3GKHuCti4qe_9VJP7CuUqJmeWkA1c X-Proofpoint-GUID: O_m3GKHuCti4qe_9VJP7CuUqJmeWkA1c X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-12_27,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 adultscore=0 impostorscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308130016 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774095940075057982 X-GMAIL-MSGID: 1774095940075057982 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 Reviewed-by: Jarkko Sakkinen --- 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/security/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" -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; if (!initialized) { initialized = true; + trust_mok = false; if (uefi_check_trust_mok_keys()) trust_mok = true;