From 2d675c1c8c9e43195bf32d5a34a54f962f35afca Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Thu, 10 Dec 2015 07:10:13 +0000 Subject: [PATCH] UefiCpuPkg/MtrrLib:Initialize local variables before use them Cc: Shumin Qiu Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Shumin Qiu git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19183 6f19259b-4bc3-4df7-8a09-765794883524 --- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;