From nobody Sat Apr 27 03:25:07 2024 Delivered-To: importer@patchew.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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1532929037954838.8855632376296; Sun, 29 Jul 2018 22:37:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F1F93210C5143; Sun, 29 Jul 2018 22:37:15 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 BDBE1210C4DD1 for ; Sun, 29 Jul 2018 22:37:14 -0700 (PDT) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2018 22:37:14 -0700 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.19]) by orsmga008.jf.intel.com with ESMTP; 29 Jul 2018 22:37:13 -0700 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,421,1526367600"; d="scan'208";a="60846929" From: Hao Wu To: edk2-devel@lists.01.org Date: Mon, 30 Jul 2018 13:37:08 +0800 Message-Id: <20180730053709.5128-2-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20180730053709.5128-1-hao.a.wu@intel.com> References: <20180730053709.5128-1-hao.a.wu@intel.com> Subject: [edk2] [PATCH 1/2] MdePkg/SmmMemLib: Avoid possible NULL ptr dereference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Jiewen Yao 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" Within function SmmMemLibInternalGetUefiMemoryAttributesTable(), add a check to avoid possible null pointer dereference. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Jiewen.yao@intel.com --- MdePkg/Library/SmmMemLib/SmmMemLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdePkg/Library/SmmMemLib/SmmMemLib.c b/MdePkg/Library/SmmMemLi= b/SmmMemLib.c index 3409ddf87c..3e458417de 100644 --- a/MdePkg/Library/SmmMemLib/SmmMemLib.c +++ b/MdePkg/Library/SmmMemLib/SmmMemLib.c @@ -439,7 +439,7 @@ SmmMemLibInternalGetUefiMemoryAttributesTable ( UINTN MemoryAttributesTableSize; =20 Status =3D EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGui= d, (VOID **)&MemoryAttributesTable); - if (!EFI_ERROR (Status)) { + if (!(EFI_ERROR (Status) || (MemoryAttributesTable =3D=3D NULL))) { MemoryAttributesTableSize =3D sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + Me= moryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntrie= s; mSmmMemLibMemoryAttributesTable =3D AllocateCopyPool (MemoryAttributes= TableSize, MemoryAttributesTable); ASSERT (mSmmMemLibMemoryAttributesTable !=3D NULL); --=20 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 03:25:07 2024 Delivered-To: importer@patchew.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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1532929040566538.6193180357704; Sun, 29 Jul 2018 22:37:20 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 382D2210C514A; Sun, 29 Jul 2018 22:37:18 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 EBC5D21B02845 for ; Sun, 29 Jul 2018 22:37:15 -0700 (PDT) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2018 22:37:15 -0700 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.19]) by orsmga008.jf.intel.com with ESMTP; 29 Jul 2018 22:37:14 -0700 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,421,1526367600"; d="scan'208";a="60846933" From: Hao Wu To: edk2-devel@lists.01.org Date: Mon, 30 Jul 2018 13:37:09 +0800 Message-Id: <20180730053709.5128-3-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20180730053709.5128-1-hao.a.wu@intel.com> References: <20180730053709.5128-1-hao.a.wu@intel.com> Subject: [edk2] [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Jiewen Yao 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" Within function GetUefiMemoryAttributesTable(), add a check to avoid possible null pointer dereference. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Jiewen.yao@intel.com --- UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPk= g/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index 7d99f23426..bae2423de8 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1098,7 +1098,7 @@ GetUefiMemoryAttributesTable ( UINTN MemoryAttributesTableSize; =20 Status =3D EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGui= d, (VOID **)&MemoryAttributesTable); - if (!EFI_ERROR (Status)) { + if (!(EFI_ERROR (Status) || (MemoryAttributesTable =3D=3D NULL))) { MemoryAttributesTableSize =3D sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + Me= moryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntrie= s; mUefiMemoryAttributesTable =3D AllocateCopyPool (MemoryAttributesTable= Size, MemoryAttributesTable); ASSERT (mUefiMemoryAttributesTable !=3D NULL); --=20 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel