From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 689EB21D147AD for ; Mon, 10 Jul 2017 20:32:17 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2017 20:34:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,344,1496127600"; d="scan'208";a="877437701" Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jul 2017 20:34:01 -0700 From: Liming Gao To: edk2-devel@lists.01.org Date: Tue, 11 Jul 2017 11:33:58 +0800 Message-Id: <1499744038-13992-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN 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: Tue, 11 Jul 2017 03:32:17 -0000 PcdGetSize() returns UINTN data type. The consumer code should use UINTN data to get its size. This issue is found when PcdCpuFeaturesSupport is configured as patchable. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 2 +- .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index 5e11b2b..e305aca 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -149,7 +149,7 @@ CpuInitDataInitialize ( CpuFeaturesData = GetCpuFeaturesData (); CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus); ASSERT (CpuFeaturesData->InitOrder != NULL); - CpuFeaturesData->BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport); + CpuFeaturesData->BitMaskSize = (UINT32) PcdGetSize (PcdCpuFeaturesSupport); // // Collect CPU Features information diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 338f1a4..dd6a82b 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -29,7 +29,7 @@ IsCpuFeatureMatch ( IN UINT8 *SecondFeatureMask ) { - UINT32 BitMaskSize; + UINTN BitMaskSize; BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport); if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) { @@ -51,7 +51,7 @@ DumpCpuFeatureMask ( { UINTN Index; UINT8 *Data8; - UINT32 BitMaskSize; + UINTN BitMaskSize; BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport); Data8 = (UINT8 *) FeatureMask; @@ -258,7 +258,7 @@ RegisterCpuFeatureWorker ( CPU_FEATURES_DATA *CpuFeaturesData; CPU_FEATURES_ENTRY *CpuFeatureEntry; LIST_ENTRY *Entry; - UINT32 BitMaskSize; + UINTN BitMaskSize; BOOLEAN FeatureExist; BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport); @@ -267,7 +267,7 @@ RegisterCpuFeatureWorker ( InitializeListHead (&CpuFeaturesData->FeatureList); InitializeSpinLock (&CpuFeaturesData->MsrLock); InitializeSpinLock (&CpuFeaturesData->MemoryMappedLock); - CpuFeaturesData->BitMaskSize = BitMaskSize; + CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize; } ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize); -- 2.8.0.windows.1