From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 29A22803DF for ; Wed, 22 Mar 2017 18:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490233481; x=1521769481; h=from:to:cc:subject:date:message-id; bh=f7c1fUzhWKORmY2PdGo+2oLRF0Tqx50NgM60Eh8rAYY=; b=sNPfSZZ134NLrqrveYcnLfqn9txJtMC8XOgIWBd8CQqQdYkAScWZp6TN SIdm5+LJCFHM2sFaCr4x+HFg2siR9Q==; Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2017 18:44:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,207,1486454400"; d="scan'208";a="80059177" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.158.57]) by fmsmga006.fm.intel.com with ESMTP; 22 Mar 2017 18:44:39 -0700 From: Jeff Fan To: edk2-devel@ml01.01.org Cc: Feng Tian , Michael Kinney Date: Thu, 23 Mar 2017 09:44:37 +0800 Message-Id: <20170323014437.8752-1-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 Subject: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Mar 2017 01:44:41 -0000 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 --- 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