From d4494b5cff75b64a70cb27b2d8544b4debb7fa6b Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Thu, 18 Mar 2021 17:09:03 +0000 Subject: Avoid creating unnecessary mirrored MOK variables If the bootservices MOK payload fits in to a single volatile runtime variable, don't create additional mirrored variables in the second pass of mirror_mok_db(). --- mok.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mok.c b/mok.c index 3d2b398c..345c322c 100644 --- a/mok.c +++ b/mok.c @@ -358,19 +358,19 @@ mirror_mok_db(CHAR16 *name, CHAR8 *name8, EFI_GUID *guid, UINT32 attrs, EFI_STATUS efi_status = EFI_SUCCESS; SIZE_T max_var_sz; - if (only_first) { - efi_status = get_max_var_sz(attrs, &max_var_sz); - if (EFI_ERROR(efi_status)) { - LogError(L"Could not get maximum variable size: %r", - efi_status); - return efi_status; - } + efi_status = get_max_var_sz(attrs, &max_var_sz); + if (EFI_ERROR(efi_status)) { + LogError(L"Could not get maximum variable size: %r", + efi_status); + return efi_status; + } - if (FullDataSize <= max_var_sz) { + if (FullDataSize <= max_var_sz) { + if (only_first) efi_status = SetVariable(name, guid, attrs, FullDataSize, FullData); - return efi_status; - } + + return efi_status; } CHAR16 *namen; -- cgit v1.2.3