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 7C874803B1 for ; Thu, 23 Mar 2017 00:21: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=1490253668; x=1521789668; h=from:to:cc:subject:date:message-id; bh=67izPdrw3BCBJ1FE6EFv/bvY4jRS0+p2gtNdGtY+0q8=; b=daNSqYYDNAqQ89PiNAAzdZIlP/FTbl4/RzC2oK5KgaauMvc0tfo+mXN3 6vFl9kUE1X7puhZTTD3GmT6p0MYmFA==; 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,208,1486454400"; d="scan'208";a="239425639" 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 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Feng Tian , Michael Kinney 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: [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: Thu, 23 Mar 2017 07:21:08 -0000 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/CpuFeaturesInitialize.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 ( BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport); SupportBitMask = AllocateZeroPool (BitMaskSize); + ASSERT (SupportBitMask != NULL); SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport); return SupportBitMask; @@ -85,6 +86,7 @@ GetConfigurationPcds ( BitMaskSize = PcdGetSize (PcdCpuFeaturesUserConfiguration); SupportBitMask = AllocateZeroPool (BitMaskSize); + ASSERT (SupportBitMask != NULL); SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfiguration); return SupportBitMask; @@ -165,6 +167,7 @@ CpuInitDataInitialize ( for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) { InitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber]; InitOrder->FeaturesSupportedMask = AllocateZeroPool (CpuFeaturesData->BitMaskSize); + ASSERT (InitOrder->FeaturesSupportedMask != NULL); InitializeListHead (&InitOrder->OrderList); Status = GetProcessorInformation (ProcessorNumber, &ProcessorInfoBuffer); ASSERT_EFI_ERROR (Status); @@ -417,6 +420,7 @@ AnalysisProcessorFeatures ( CpuFeaturesData = GetCpuFeaturesData (); CpuFeaturesData->CapabilityPcds = AllocatePool (CpuFeaturesData->BitMaskSize); + ASSERT (CpuFeaturesData->CapabilityPcds != NULL); SetMem (CpuFeaturesData->CapabilityPcds, CpuFeaturesData->BitMaskSize, 0xFF); for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) { CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber]; @@ -430,6 +434,7 @@ AnalysisProcessorFeatures ( // CpuFeaturesData->SettingPcds = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcds); + ASSERT (CpuFeaturesData->SettingPcds != NULL); SupportedMaskAnd (CpuFeaturesData->SettingPcds, CpuFeaturesData->ConfigurationPcds); // @@ -478,6 +483,7 @@ AnalysisProcessorFeatures ( CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry); if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcds)) { CpuFeatureInOrder = AllocateCopyPool (sizeof (CPU_FEATURES_ENTRY), CpuFeature); + ASSERT (CpuFeatureInOrder != NULL); InsertTailList (&CpuInitOrder->OrderList, &CpuFeatureInOrder->Link); } Entry = Entry->ForwardLink; -- 2.9.3.windows.2