summaryrefslogtreecommitdiff
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2017-08-16 13:20:36 +0800
committerEric Dong <eric.dong@intel.com>2017-08-17 09:17:22 +0800
commit6619cf3b6a84397ceff5d856111a33f9cdfb0812 (patch)
treef8102864084d9f266efa474e1ce58e783fd0b1aa /UefiCpuPkg
parentaa0f2bf7cc879dc732164d1ea003b53e244c2ff4 (diff)
downloadedk2-6619cf3b6a84397ceff5d856111a33f9cdfb0812.zip
edk2-6619cf3b6a84397ceff5d856111a33f9cdfb0812.tar.gz
edk2-6619cf3b6a84397ceff5d856111a33f9cdfb0812.tar.bz2
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>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 474aea3..b8f76f1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -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;
}