From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 C9ED98042A for ; Wed, 22 Mar 2017 18:52: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=1490233961; x=1521769961; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=t+f2ZtMDl66uLt2tFXzxY5lqrQZQXNCITrZ2QKx3aW8=; b=BZbwz8dHxxHtgCbjjecvi1WK1GUBMdUpIR8bJV0EyUCi1bqi+MjealCX kEQimr1yStvSPWB+pMxyyXuuVTBoyA==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2017 18:52:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,207,1486454400"; d="scan'208";a="79635746" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 22 Mar 2017 18:52:41 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Mar 2017 18:52:41 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Mar 2017 18:52:41 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Thu, 23 Mar 2017 09:52:39 +0800 From: "Tian, Feng" To: "Fan, Jeff" , "edk2-devel@ml01.01.org" CC: "Kinney, Michael D" , "Tian, Feng" Thread-Topic: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value Thread-Index: AQHSo3cPef7jTYSS0kaXTI/WpyUK06GhqVMw Date: Thu, 23 Mar 2017 01:52:39 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699BCDA6@SHSMSX101.ccr.corp.intel.com> References: <20170323014437.8752-1-jeff.fan@intel.com> In-Reply-To: <20170323014437.8752-1-jeff.fan@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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:52:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian -----Original Message----- From: Fan, Jeff=20 Sent: Thursday, March 23, 2017 9:45 AM To: edk2-devel@ml01.01.org Cc: Tian, Feng ; Kinney, Michael D Subject: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry ini= tial value CpuFeatureEntry will be set before using it. But VS2012 build reported the = build warning "potentially uninitialized local variable 'CpuFeatureEntry' u= sed". 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/RegisterCpuFeaturesL= ib.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 =3D=3D BitMaskSize); =20 FeatureExist =3D FALSE; + CpuFeatureEntry =3D NULL; Entry =3D GetFirstNode (&CpuFeaturesData->FeatureList); while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) { CpuFeatureEntry =3D CPU_FEATURE_ENTRY_FROM_LINK (Entry); @@ -293,6 +29= 4,7 @@ RegisterCpuFeatureWorker ( } else { DEBUG ((DEBUG_INFO, "[OVERRIDE] ")); DumpCpuFeature (CpuFeature); + ASSERT (CpuFeatureEntry !=3D NULL); // // Overwrite original parameters of CPU feature // -- 2.9.3.windows.2