How about to use AllocateCopyPool()? Thanks/Ray
> -----Original Message----- > From: edk2-devel [mailto:[email protected]] On Behalf Of > Eric Dong > Sent: Tuesday, August 15, 2017 1:32 PM > To: [email protected] > Cc: Ni, Ruiyu <[email protected]>; Shao, Ming <[email protected]>; > [email protected] > Subject: [edk2] [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer > pointer error usage. > > Current code allocate buffer for the pointer which later get value from PCD > database. but current code error use "=" for this case. > Use CopyMem instead to fix it. > > Cc: Ruiyu Ni <[email protected]> > Cc: Shao, Ming <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong <[email protected]> > --- > UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > 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 = PcdGetSize (PcdCpuFeaturesSupport); > SupportBitMask = AllocateZeroPool (BitMaskSize); > ASSERT (SupportBitMask != NULL); > - SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport); > + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr > (PcdCpuFeaturesSupport), > + BitMaskSize); > > return SupportBitMask; > } > @@ -87,7 +87,7 @@ GetConfigurationPcds ( > BitMaskSize = PcdGetSize (PcdCpuFeaturesUserConfiguration); > SupportBitMask = AllocateZeroPool (BitMaskSize); > ASSERT (SupportBitMask != NULL); > - SupportBitMask = (UINT8 *) PcdGetPtr > (PcdCpuFeaturesUserConfiguration); > + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr > + (PcdCpuFeaturesUserConfiguration), BitMaskSize); > > return SupportBitMask; > } > -- > 2.7.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

