From: Gary Lin Date: Thu, 26 May 2016 10:24:14 +0000 (+0800) Subject: OvmfPkg/SerializeVariablesLib: Relax check for the read-only variable X-Git-Tag: edk2-stable201903~6937 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=db827286e2839102c5b0a45f88a99b8ef94c6d48 OvmfPkg/SerializeVariablesLib: Relax check for the read-only variable When OVMF tried to restore the variables from the file-based NvVars, it failed to set the read-only variable and aborted the restoration with this message: Variable Check ReadOnly variable fail Write Protected - 04B37FE8-F6AE-480B-BDD5-37D98C5E89AA:VarErrorFlag Since it's a read-only variable maintained by the firmware, it's pointless to restore the previous value, so the check can be relaxed to allow EFI_WRITE_PROTECTED returned from SetVariable. Cc: Laszlo Ersek Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin Reviewed-by: Laszlo Ersek --- diff --git a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c index 3a24edcd48..a1a3d188f2 100644 --- a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c +++ b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c @@ -302,6 +302,11 @@ IterateVariablesCallbackSetSystemVariable ( "failed with EFI_SECURITY_VIOLATION, ignoring\n", __FUNCTION__, VariableName)); Status = EFI_SUCCESS; + } else if (Status == EFI_WRITE_PROTECTED) { + DEBUG ((DEBUG_WARN, "%a: setting ReadOnly variable \"%s\" " + "failed with EFI_WRITE_PROTECTED, ignoring\n", __FUNCTION__, + VariableName)); + Status = EFI_SUCCESS; } return Status; }