]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value
authorJeff Fan <jeff.fan@intel.com>
Thu, 23 Mar 2017 01:37:47 +0000 (09:37 +0800)
committerJeff Fan <jeff.fan@intel.com>
Thu, 23 Mar 2017 02:00:53 +0000 (10:00 +0800)
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 <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c

index 7a1470bd367d077df5c961705d41fbb44bcbf6f9..396618b0573eca6686d463f4858d1862ec749fe0 100644 (file)
@@ -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
     //