mirror of https://github.com/acidanthera/audk.git
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 AllocateCopyPool instead to fix it. V2 enhanced to directly use AllocateCopyPool to get the PCD value. V3 enhanced to avoid using local temp variable. V4 enhanced to keep the functions to get the pcd values. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Shao Ming <ming.shao@intel.com> Cc: Kinney Michael D <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Kinney Michael D <michael.d.kinney@intel.com>
This commit is contained in:
parent
aa0f2bf7cc
commit
6619cf3b6a
|
@ -60,13 +60,13 @@ GetSupportPcds (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
UINTN BitMaskSize;
|
||||
UINT8 *SupportBitMask;
|
||||
|
||||
BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
|
||||
SupportBitMask = AllocateZeroPool (BitMaskSize);
|
||||
SupportBitMask = AllocateCopyPool (
|
||||
PcdGetSize (PcdCpuFeaturesSupport),
|
||||
PcdGetPtr (PcdCpuFeaturesSupport)
|
||||
);
|
||||
ASSERT (SupportBitMask != NULL);
|
||||
SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport);
|
||||
|
||||
return SupportBitMask;
|
||||
}
|
||||
|
@ -81,13 +81,13 @@ GetConfigurationPcds (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
UINTN BitMaskSize;
|
||||
UINT8 *SupportBitMask;
|
||||
|
||||
BitMaskSize = PcdGetSize (PcdCpuFeaturesUserConfiguration);
|
||||
SupportBitMask = AllocateZeroPool (BitMaskSize);
|
||||
SupportBitMask = AllocateCopyPool (
|
||||
PcdGetSize (PcdCpuFeaturesUserConfiguration),
|
||||
PcdGetPtr (PcdCpuFeaturesUserConfiguration)
|
||||
);
|
||||
ASSERT (SupportBitMask != NULL);
|
||||
SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfiguration);
|
||||
|
||||
return SupportBitMask;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue