From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 47EBAAC1727 for ; Wed, 25 Oct 2023 10:11:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=VG5BdRis7waWce/+AImb+MgUvsKTxrBZMBXMzAl3QCs=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698228709; v=1; b=Hbn+Wb/2XDAc3o3XSxBuCxoKyeVmHBmEd6TEKG3izCC+W+kK72CWO2CNUBA1iPyZGAMrVv1i vcPNVMt2jhk169Dk1YBHtgf4bK1idV4XeT90KDX6+/AD0czW0yqXsTsj1D5AqbxNriJalYC9Pc4 7HUdl4jlQdIzjVeDPSH2XpaE= X-Received: by 127.0.0.2 with SMTP id zADoYY7687511xvmdZLBIhq8; Wed, 25 Oct 2023 03:11:49 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.40155.1698228708155824147 for ; Wed, 25 Oct 2023 03:11:48 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-rStEspJkMny906L9d3SoPA-1; Wed, 25 Oct 2023 06:11:34 -0400 X-MC-Unique: rStEspJkMny906L9d3SoPA-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C36BF3C0C49F; Wed, 25 Oct 2023 10:11:33 +0000 (UTC) X-Received: from [10.39.192.250] (unknown [10.39.192.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4283D1121319; Wed, 25 Oct 2023 10:11:32 +0000 (UTC) Message-ID: Date: Wed, 25 Oct 2023 12:11:31 +0200 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH V2 1/1] OvmfPkg/AcpiPlatformDxe: Fix Coverity report issues To: devel@edk2.groups.io, cepingx.sun@intel.com Cc: Erdem Aktas , James Bottomley , Jiewen Yao , Min Xu , Tom Lendacky , Michael Roth , Gerd Hoffmann References: <20231023090539.1003-1-cepingx.sun@intel.com> From: "Laszlo Ersek" In-Reply-To: <20231023090539.1003-1-cepingx.sun@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: uFzR05CB51PPaT7glESEAvyDx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="Hbn+Wb/2"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 10/23/23 11:05, sunceping wrote: > From: Ceping Sun >=20 > v1 -> v2 Changed list: > 1:Since both commits are intended to fix coverity issues, they are merge= d into one > 2: Changed the debug info level to debug error when "DsdtTable =3D=3D NU= LL" > 3:Add the Cc member as below > Erdem Aktas erdemaktas@google.com > James Bottomley jejb@linux.ibm.com > Tom Lendacky thomas.lendacky@amd.com > Michael Roth michael.roth@amd.com >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4568 >=20 > The function InstallCloudHvTablesTdx had an Assert when "DsdtTable =3D=3D= NULL", > 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. >=20 > In addition, the status of "AcpiProtocol->InstallAcpiTable" is overwritte= n before > it can be used in the function, it is better to check it before overwriti= ng. >=20 > code: https://github.com/sunceping/edk2/tree/fixcoverityerrors.v2 >=20 > Cc: Erdem Aktas > Cc: James Bottomley > Cc: Jiewen Yao > Cc: Min Xu > Cc: Tom Lendacky > Cc: Michael Roth > Cc: Gerd Hoffmann > Signed-off-by: Ceping Sun > --- > OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/CloudHvAcpi.c > index d3e73c155e8f..4629fa260366 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))); > } > @@ -69,8 +74,9 @@ InstallCloudHvTablesTdx ( > // then we're out of sync with the hypervisor, and cannot continue. > // > if (DsdtTable =3D=3D NULL) { > - DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __func__)); > + DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __func__)); > ASSERT (FALSE); > + CpuDeadLoop (); > } > =20 > Status =3D AcpiProtocol->InstallAcpiTable ( merged via as commit cf87fd95c1f5be4880a015c82a18e8ae12ff5e94 -=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 (#110030): https://edk2.groups.io/g/devel/message/110030 Mute This Topic: https://groups.io/mt/102131520/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-