public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@ml01.01.org
Cc: Feng Tian <feng.tian@intel.com>,
	Michael Kinney <michael.d.kinney@intel.com>
Subject: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value
Date: Thu, 23 Mar 2017 09:44:37 +0800	[thread overview]
Message-ID: <20170323014437.8752-1-jeff.fan@intel.com> (raw)

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>
---
 UefiCpuPkg/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 7a1470b..396618b 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
     //
-- 
2.9.3.windows.2



             reply	other threads:[~2017-03-23  1:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23  1:44 Jeff Fan [this message]
2017-03-23  1:52 ` [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value Tian, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170323014437.8752-1-jeff.fan@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox