From nobody Sat May 18 10:07:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109792+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109792+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1697696529; cv=none; d=zohomail.com; s=zohoarc; b=NGddy+007XqTk6WxAqZjLubiurBFSAGF1fDP4Gnwcbi9vPzezHZJPGyjk46EKtQNIB8Om3GC3VvwmpEfX1NMJE2FC9BIJ/jrNTAsCyH04t5pbxkDS4N1ggcXEdkaVYuza0DVxR552FHI7hy08CjYxvOjGYfYGsin5TVezNbjvZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697696529; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=Z2bCvFPUT+ysszkkGHYQBn17V7pKx1hQZZU44s8jcSo=; b=S84j2lz+Yn8h+1cNKNgLxkssuaDPDFS4mdxbV5ZD2C7ns6EdWe7YJj7Q3f3JLYUvUBpXgWGkEE2GX0qYe+q/iSlLbNV9bgr0/13iG8zon9q4vWjs0LqjGuBxx05rf8GECcjRosMi4aZHtE9L0FLtRAZJIXDmydoM46zF/AxPQKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109792+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697696529684959.7654505868347; Wed, 18 Oct 2023 23:22:09 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=hPzbq6bJC3867pj9XHUPb/VdGAF/PzNd2cjs7KyXAzc=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1697696529; v=1; b=DiUzfWIpj+lD0d+rtQ61OMgCq9adHs0NO43LRkhzOiUgKoSTzWv/W23GRthYjLknNw/ocjjb AUCZhoE5xOE5imjhOsm5jHDwLwlS+1NFepC0lRtEGi7/u/6rsQK/C1uX3RXvpI/prlPH8VnLDil GtoDTYjGHCmWA18zXxkHer3k= X-Received: by 127.0.0.2 with SMTP id Vu6eYY1788612xjxXFrcUAvD; Wed, 18 Oct 2023 23:22:09 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.21317.1697696528851296879 for ; Wed, 18 Oct 2023 23:22:08 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="365533562" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="365533562" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 23:22:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="900632414" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="900632414" X-Received: from cepingsx-mobl1.ccr.corp.intel.com ([10.239.49.140]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 23:20:01 -0700 From: "sunceping" To: devel@edk2.groups.io Cc: Ceping Sun , Gerd Hoffmann , Jiewen Yao , Min Xu Subject: [edk2-devel] [PATCH V1 1/2] OvmfPkg/AcpiPlatformDxe: Avoid possible NULL pointer dereference Date: Thu, 19 Oct 2023 14:21:41 +0800 Message-Id: <20231019062142.417-2-cepingx.sun@intel.com> In-Reply-To: <20231019062142.417-1-cepingx.sun@intel.com> References: <20231019062142.417-1-cepingx.sun@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,cepingx.sun@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: gdZLEKOqFhXHsozzJ803DhYVx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697696530505100001 Content-Type: text/plain; charset="utf-8" From: Ceping Sun REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4568 The function InstallCloudHvTablesTdx had an Assert when "DsdtTable =3D=3D N= ULL", but this comes into play only in DEBUG mode. In Release mode , there is no handling if the pointer is NULL. To avoid the possible null pointer dereference, it is better to handle it when the pointer is null. Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Min Xu Signed-off-by: Ceping Sun --- OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDx= e/CloudHvAcpi.c index d3e73c155e8f..24c22bb646ca 100644 --- a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c @@ -71,6 +71,7 @@ InstallCloudHvTablesTdx ( if (DsdtTable =3D=3D NULL) { DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __func__)); ASSERT (FALSE); + CpuDeadLoop (); } =20 Status =3D AcpiProtocol->InstallAcpiTable ( --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109792): https://edk2.groups.io/g/devel/message/109792 Mute This Topic: https://groups.io/mt/102055424/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 10:07:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109793+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109793+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1697696532; cv=none; d=zohomail.com; s=zohoarc; b=npEuDhhFkxoRPS+qH14dzVdBYLQY70Xn29zNAKvlgGSJkogFA2A8WV2kSi5DCDhS3WI9RCNlGYepgUI9GIABI+isjpMZwEv5pW52Q1xHK857XhhtZGm2TEFHO1ioxJLK1dGbdnqXYuE6STVZhaBnZYnGljYKxvJ7Gj5tBSY29UI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697696532; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=TIGl8OHHaZKxjKbrvzlxMDkWHVa/Hhafyvq4qYZgIIk=; b=Fk0BKsjmE9Fkfmhh+9uBEi8xQXNuTYugwqlBmLa/KT+pT3HNGwdnIk4zbDgLzt/OKOkYfiJXsMtQw1ACOf3meLOr0+1myuA0F/RW/JJ1pHrB9r0mVvBXxk3FL+1ms0KMob15EF0h6Of1d/S+cMRdEHDLGsNJK7mhzqRWPLD/h9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109793+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697696532460968.9449410828191; Wed, 18 Oct 2023 23:22:12 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=OOqQXcyLwp6aT5KVzUSXI7L+D+e3vg9jBYt0fJce6pY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1697696532; v=1; b=KePGnGHzGAnhZFbBpnByNqbG1AD8kdts2vEYxNd0Nwoff0m0sQXtQT6qGHkZoiG0WF78RKXS GCq9XmvDUO1UEnUGzOqZPF9YhhqbybeasqofkHACGRq+l1WtqaYlPyBrwJYtK8c3W76EBMRrOYv 9YETkbzkSfhunuXiCaF8iqKI= X-Received: by 127.0.0.2 with SMTP id Xaq1YY1788612x8XmQt9qF9M; Wed, 18 Oct 2023 23:22:12 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.21317.1697696528851296879 for ; Wed, 18 Oct 2023 23:22:11 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="365533586" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="365533586" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 23:22:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="900632429" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="900632429" X-Received: from cepingsx-mobl1.ccr.corp.intel.com ([10.239.49.140]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 23:20:03 -0700 From: "sunceping" To: devel@edk2.groups.io Cc: Ceping Sun , Gerd Hoffmann , Jiewen Yao , Min Xu Subject: [edk2-devel] [PATCH V1 2/2] OvmfPkg/AcpiPlatformDxe: Check the status to ensure no error Date: Thu, 19 Oct 2023 14:21:42 +0800 Message-Id: <20231019062142.417-3-cepingx.sun@intel.com> In-Reply-To: <20231019062142.417-1-cepingx.sun@intel.com> References: <20231019062142.417-1-cepingx.sun@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,cepingx.sun@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: DA8KygCwTdMTVE63Kw1PeAWdx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697696534495100007 Content-Type: text/plain; charset="utf-8" From: Ceping Sun REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4568 The status of "AcpiProtocol->InstallAcpiTable" is overwritten before it can be used, it is better to check it before overwriting. Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Min Xu Signed-off-by: Ceping Sun --- OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDx= e/CloudHvAcpi.c index 24c22bb646ca..7e2adcaa82d3 100644 --- a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c @@ -53,6 +53,11 @@ InstallCloudHvTablesTdx ( CurrentTable->Length, &TableHandle ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + for (UINTN i =3D 0; i < CurrentTable->Length; i++) { DEBUG ((DEBUG_INFO, " %x", *((UINT8 *)CurrentTable + i))); } --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109793): https://edk2.groups.io/g/devel/message/109793 Mute This Topic: https://groups.io/mt/102055425/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-