How about to use AllocateCopyPool()? Thanks/Ray
> -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@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 <ruiyu...@intel.com>; Shao, Ming <ming.s...@intel.com>; > s...@ml01.01.org > 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 <ruiyu...@intel.com> > Cc: Shao, Ming <ming.s...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong <eric.d...@intel.com> > --- > 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 > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel