]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
integrity: remove global variable from machine_keyring.c
authorNayna Jain <nayna@linux.ibm.com>
Tue, 15 Aug 2023 11:27:19 +0000 (07:27 -0400)
committerJarkko Sakkinen <jarkko@kernel.org>
Thu, 17 Aug 2023 20:12:35 +0000 (20:12 +0000)
trust_mok variable is accessed within a single function locally.

Change trust_mok from global to local static variable.

Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
security/integrity/platform_certs/machine_keyring.c

index 389a6e7c92458ceb210b59b0c6784fcae5ba60c8..9482e16cb2caac0a90ab5757ba786d1bac8623a8 100644 (file)
@@ -8,8 +8,6 @@
 #include <linux/efi.h>
 #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;