From nobody Sat Nov 2 10:30:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 149025367173076.81859466364904; Thu, 23 Mar 2017 00:21:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 821DC8040E; Thu, 23 Mar 2017 00:21:09 -0700 (PDT) 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 7C874803B1 for ; Thu, 23 Mar 2017 00:21:08 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2017 00:21:08 -0700 Received: from jfan12-desk.ccr.corp.intel.com ([10.239.158.57]) by fmsmga004.fm.intel.com with ESMTP; 23 Mar 2017 00:21:07 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490253668; x=1521789668; h=from:to:cc:subject:date:message-id; bh=67izPdrw3BCBJ1FE6EFv/bvY4jRS0+p2gtNdGtY+0q8=; b=daNSqYYDNAqQ89PiNAAzdZIlP/FTbl4/RzC2oK5KgaauMvc0tfo+mXN3 6vFl9kUE1X7puhZTTD3GmT6p0MYmFA==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,208,1486454400"; d="scan'208";a="239425639" From: Jeff Fan To: edk2-devel@lists.01.org Date: Thu, 23 Mar 2017 15:20:52 +0800 Message-Id: <20170323072052.5228-1-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 Subject: [edk2] [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: , Cc: Michael Kinney , Feng Tian MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian --- 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