public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Eric Dong <eric.dong@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>, Shao, Ming <ming.shao@intel.com>
Subject: [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage.
Date: Tue, 15 Aug 2017 13:31:37 +0800	[thread overview]
Message-ID: <1502775098-14688-2-git-send-email-eric.dong@intel.com> (raw)
In-Reply-To: <1502775098-14688-1-git-send-email-eric.dong@intel.com>

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.ni@intel.com>
Cc: Shao, Ming <ming.shao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@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



  reply	other threads:[~2017-08-15  5:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15  5:31 [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Enhance debug messages Eric Dong
2017-08-15  5:31 ` Eric Dong [this message]
2017-08-15  5:44   ` [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage Ni, Ruiyu
2017-08-15  5:31 ` [Patch] UefiCpuPkg BaseUefiCpuLib: remove error reference code Eric Dong
2017-08-16  8:13   ` Ni, Ruiyu
2017-08-16  8:14     ` Dong, Eric
2017-08-16  8:12 ` [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Enhance debug messages Ni, Ruiyu
  -- strict thread matches above, loose matches on Subject: below --
2017-08-16  1:03 [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage Eric Dong
2017-08-16  2:40 ` Kinney, Michael D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502775098-14688-2-git-send-email-eric.dong@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox