From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 ECD7721D147A7 for ; Tue, 11 Jul 2017 08:06:32 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2017 08:08:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,347,1496127600"; d="scan'208";a="110011602" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 11 Jul 2017 08:08:17 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 08:08:17 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 08:08:17 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002; Tue, 11 Jul 2017 23:08:15 +0800 From: "Fan, Jeff" To: "Gao, Liming" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN Thread-Index: AQHS+faQC4hiW829/kC3gqA8EgyAZqJOuxeg Date: Tue, 11 Jul 2017 15:08:14 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C623EEE@shsmsx102.ccr.corp.intel.com> References: <1499744038-13992-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1499744038-13992-1-git-send-email-liming.gao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDVmMTBhNmUtYjc5OC00MjE5LTk0ZTktZmY2ZGEwNjUxYjRlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IldkQUd2Tmlhc2VBQXNKMUErakVzb21uNXJCWk95Tnp5YUZrWFZkdUZZNnc9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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 15:06:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Limi= ng Gao Sent: Tuesday, July 11, 2017 11:34 AM To: edk2-devel@lists.01.org Subject: [edk2] [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consum= e PcdGetSize with UINTN PcdGetSize() returns UINTN data type. The consumer code should use UINTN da= ta 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/CpuFeaturesInitializ= e.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 =3D GetCpuFeaturesData (); CpuFeaturesData->InitOrder =3D AllocateZeroPool (sizeof (CPU_FEATURES_IN= IT_ORDER) * NumberOfCpus); ASSERT (CpuFeaturesData->InitOrder !=3D NULL); - CpuFeaturesData->BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); + CpuFeaturesData->BitMaskSize =3D (UINT32) PcdGetSize=20 + (PcdCpuFeaturesSupport); =20 // // Collect CPU Features information diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesL= ib.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; =20 BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) =3D=3D= 0) { @@ -51,7 +51,7 @@ DumpCpuFeatureMask ( { UINTN Index; UINT8 *Data8; - UINT32 BitMaskSize; + UINTN BitMaskSize; =20 BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); Data8 =3D (UINT8 *) FeatureMask; @@ -258,7 +258,7 @@ RegisterCpuFeatureWorker ( CPU_FEATURES_DATA *CpuFeaturesData; CPU_FEATURES_ENTRY *CpuFeatureEntry; LIST_ENTRY *Entry; - UINT32 BitMaskSize; + UINTN BitMaskSize; BOOLEAN FeatureExist; =20 BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); @@ -267,7 +267,7 @@ RegisterCpuFeatureWorker ( InitializeListHead (&CpuFeaturesData->FeatureList); InitializeSpinLock (&CpuFeaturesData->MsrLock); InitializeSpinLock (&CpuFeaturesData->MemoryMappedLock); - CpuFeaturesData->BitMaskSize =3D BitMaskSize; + CpuFeaturesData->BitMaskSize =3D (UINT32) BitMaskSize; } ASSERT (CpuFeaturesData->BitMaskSize =3D=3D BitMaskSize); =20 -- 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel