From cab6b79cf4958044aa384dc6c1f6ef62ffd8a357 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Thu, 23 Mar 2017 09:37:47 +0800 Subject: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value CpuFeatureEntry will be set before using it. But VS2012 build reported the build warning "potentially uninitialized local variable 'CpuFeatureEntry' used". This fix is to set CpuFeatureEntry initial value and add ASSERT check later. Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian --- .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 7a1470bd36..396618b057 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -272,6 +272,7 @@ RegisterCpuFeatureWorker ( ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize); FeatureExist = FALSE; + CpuFeatureEntry = NULL; Entry = GetFirstNode (&CpuFeaturesData->FeatureList); while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) { CpuFeatureEntry = CPU_FEATURE_ENTRY_FROM_LINK (Entry); @@ -293,6 +294,7 @@ RegisterCpuFeatureWorker ( } else { DEBUG ((DEBUG_INFO, "[OVERRIDE] ")); DumpCpuFeature (CpuFeature); + ASSERT (CpuFeatureEntry != NULL); // // Overwrite original parameters of CPU feature //