From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 998F121BC6A7F for ; Sun, 26 Mar 2017 22:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490592608; x=1522128608; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=yPRlqMFCDNACA78jglUDY3QxohIsM9eHwK/eRPwTZBA=; b=VU1kWEUK1JCqVh3fcpbPB1PTs6zAbyT5p6Gyp7wSE78iXfArc2W7hcrL ypIfJzyla8cTDI18u5OSSyVaL2I6og==; Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2017 22:30:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,229,1486454400"; d="scan'208";a="65365682" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 26 Mar 2017 22:30:07 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 26 Mar 2017 22:30:07 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.224]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.82]) with mapi id 14.03.0248.002; Mon, 27 Mar 2017 13:30:03 +0800 From: "Tian, Feng" To: "Fan, Jeff" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Tian, Feng" Thread-Topic: [edk2] [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on allocated memory Thread-Index: AQHSo6Yajqpu3T6yBE+0iufuo11y9aGoLvXQ Date: Mon, 27 Mar 2017 05:30:02 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699CF1D4@SHSMSX101.ccr.corp.intel.com> References: <20170323072052.5228-1-jeff.fan@intel.com> In-Reply-To: <20170323072052.5228-1-jeff.fan@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on allocated memory 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: Mon, 27 Mar 2017 05:30:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian Thanks Feng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fan,= Jeff Sent: Thursday, March 23, 2017 3:21 PM To: edk2-devel@lists.01.org Cc: Kinney, Michael D ; Tian, Feng Subject: [edk2] [PATCH] UefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on al= located memory Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 ++++= ++ 1 file changed, 6 insertions(+) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index 34e6c6b..cd689af 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -65,6 +65,7 @@ GetSupportPcds ( =20 BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); SupportBitMask =3D AllocateZeroPool (BitMaskSize); + ASSERT (SupportBitMask !=3D NULL); SupportBitMask =3D (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport); =20 return SupportBitMask; @@ -85,6 +86,7 @@ GetConfigurationPcds ( =20 BitMaskSize =3D PcdGetSize (PcdCpuFeaturesUserConfiguration); SupportBitMask =3D AllocateZeroPool (BitMaskSize); + ASSERT (SupportBitMask !=3D NULL); SupportBitMask =3D (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfiguration)= ; =20 return SupportBitMask; @@ -165,6 +167,7 @@ CpuInitDataInitialize ( for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum= ber++) { InitOrder =3D &CpuFeaturesData->InitOrder[ProcessorNumber]; InitOrder->FeaturesSupportedMask =3D AllocateZeroPool (CpuFeaturesData= ->BitMaskSize); + ASSERT (InitOrder->FeaturesSupportedMask !=3D NULL); InitializeListHead (&InitOrder->OrderList); Status =3D GetProcessorInformation (ProcessorNumber, &ProcessorInfoBuf= fer); ASSERT_EFI_ERROR (Status); @@ -417,6 +420,7 @@ AnalysisProcessorFeatures ( =20 CpuFeaturesData =3D GetCpuFeaturesData (); CpuFeaturesData->CapabilityPcds =3D AllocatePool (CpuFeaturesData->BitMa= skSize); + ASSERT (CpuFeaturesData->CapabilityPcds !=3D NULL); SetMem (CpuFeaturesData->CapabilityPcds, CpuFeaturesData->BitMaskSize, 0= xFF); for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum= ber++) { CpuInitOrder =3D &CpuFeaturesData->InitOrder[ProcessorNumber]; @@ -430,6 +434,7 @@ AnalysisProcessorFeatures ( // =20 CpuFeaturesData->SettingPcds =3D AllocateCopyPool (CpuFeaturesData->BitM= askSize, CpuFeaturesData->CapabilityPcds); + ASSERT (CpuFeaturesData->SettingPcds !=3D NULL); SupportedMaskAnd (CpuFeaturesData->SettingPcds, CpuFeaturesData->Configu= rationPcds); =20 // @@ -478,6 +483,7 @@ AnalysisProcessorFeatures ( CpuFeature =3D CPU_FEATURE_ENTRY_FROM_LINK (Entry); if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->Capabi= lityPcds)) { CpuFeatureInOrder =3D AllocateCopyPool (sizeof (CPU_FEATURES_ENTRY= ), CpuFeature); + ASSERT (CpuFeatureInOrder !=3D NULL); InsertTailList (&CpuInitOrder->OrderList, &CpuFeatureInOrder->Link= ); } Entry =3D Entry->ForwardLink; --=20 2.9.3.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel