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 68B6F2095DB90 for ; Mon, 14 Aug 2017 22:41:59 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2017 22:44:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,376,1498546800"; d="scan'208";a="123662297" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 14 Aug 2017 22:44:16 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 14 Aug 2017 22:44:15 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 14 Aug 2017 22:44:15 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.114]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.236]) with mapi id 14.03.0319.002; Tue, 15 Aug 2017 13:44:13 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Shao, Ming" , "Shao@ml01.01.org" Thread-Topic: [edk2] [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage. Thread-Index: AQHTFYfNzTd84zycl0OVcX0i0z3EQKKE5+gA Date: Tue, 15 Aug 2017 05:44:13 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B9ED1E2@SHSMSX104.ccr.corp.intel.com> References: <1502775098-14688-1-git-send-email-eric.dong@intel.com> <1502775098-14688-2-git-send-email-eric.dong@intel.com> In-Reply-To: <1502775098-14688-2-git-send-email-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage. 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, 15 Aug 2017 05:41:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable How about to use AllocateCopyPool()? Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Eric Dong > Sent: Tuesday, August 15, 2017 1:32 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Shao, Ming ; > Shao@ml01.01.org > Subject: [edk2] [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer > pointer error usage. >=20 > Current code allocate buffer for the pointer which later get value from P= CD > database. but current code error use "=3D" for this case. > Use CopyMem instead to fix it. >=20 > Cc: Ruiyu Ni > Cc: Shao, Ming > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong > --- > UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 4 ++= -- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index 474aea3..77834ae 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -66,7 +66,7 @@ GetSupportPcds ( > BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); > SupportBitMask =3D AllocateZeroPool (BitMaskSize); > ASSERT (SupportBitMask !=3D NULL); > - SupportBitMask =3D (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport); > + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr > (PcdCpuFeaturesSupport), > + BitMaskSize); >=20 > return SupportBitMask; > } > @@ -87,7 +87,7 @@ GetConfigurationPcds ( > BitMaskSize =3D PcdGetSize (PcdCpuFeaturesUserConfiguration); > SupportBitMask =3D AllocateZeroPool (BitMaskSize); > ASSERT (SupportBitMask !=3D NULL); > - SupportBitMask =3D (UINT8 *) PcdGetPtr > (PcdCpuFeaturesUserConfiguration); > + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr > + (PcdCpuFeaturesUserConfiguration), BitMaskSize); >=20 > return SupportBitMask; > } > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel