From nobody Sat Apr 27 18:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502775107984496.38890150163286; Mon, 14 Aug 2017 22:31:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 05B2021E1DAF2; Mon, 14 Aug 2017 22:29:20 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 74B2421DFC878 for ; Mon, 14 Aug 2017 22:29:18 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2017 22:31:43 -0700 Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.51]) by orsmga005.jf.intel.com with ESMTP; 14 Aug 2017 22:31:41 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,376,1498546800"; d="scan'208";a="137503228" From: Eric Dong To: edk2-devel@lists.01.org Date: Tue, 15 Aug 2017 13:31:37 +0800 Message-Id: <1502775098-14688-2-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1502775098-14688-1-git-send-email-eric.dong@intel.com> References: <1502775098-14688-1-git-send-email-eric.dong@intel.com> Subject: [edk2] [Patch] UefiCpuPkg RegisterCpuFeaturesLib: Fix buffer pointer error usage. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Ming , Shao@ml01.01.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Current code allocate buffer for the pointer which later get value from PCD database. but current code error use "=3D" for this case. Use CopyMem instead to fix it. Cc: Ruiyu Ni Cc: Shao, Ming Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.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 =3D PcdGetSize (PcdCpuFeaturesSupport); SupportBitMask =3D AllocateZeroPool (BitMaskSize); ASSERT (SupportBitMask !=3D NULL); - SupportBitMask =3D (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport); + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport), Bi= tMaskSize); =20 return SupportBitMask; } @@ -87,7 +87,7 @@ GetConfigurationPcds ( BitMaskSize =3D PcdGetSize (PcdCpuFeaturesUserConfiguration); SupportBitMask =3D AllocateZeroPool (BitMaskSize); ASSERT (SupportBitMask !=3D NULL); - SupportBitMask =3D (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfiguration); + CopyMem (SupportBitMask, (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfigur= ation), BitMaskSize); =20 return SupportBitMask; } --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel