diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index f5b3460f13..199e165d46 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -1489,7 +1489,9 @@ MtrrSetMemoryAttributeWorker ( UINT64 NewValue; MTRR_VARIABLE_SETTINGS *VariableSettings; - MtrrContextValid = FALSE; + MtrrContextValid = FALSE; + VariableMtrrCount = 0; + ZeroMem (&WorkingFixedSettings, sizeof (WorkingFixedSettings)); for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) { FixedSettingsValid[Index] = FALSE; FixedSettingsModified[Index] = FALSE;