public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "sunceping" <cepingx.sun@intel.com>
To: devel@edk2.groups.io
Cc: sunceping <cepingx.sun@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>, Min Xu <min.m.xu@intel.com>
Subject: [edk2-devel] [PATCH V1 0/2] OvmfPkg/AcpiPlatformDxe: Fix the coverity errors
Date: Thu, 19 Oct 2023 14:21:40 +0800	[thread overview]
Message-ID: <20231019062142.417-1-cepingx.sun@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4568

Coverity report 2 issues in OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c.

In the function InstallCloudHvTablesTdx, the pointer is already checked. 
  if (DsdtTable == NULL) {
    DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __func__));
    ASSERT (FALSE);
  }
But this comes into play only in DEBUG mode, in Release mode, that would be an error 
with dereferencing null pointer. Fix this by adding CpuDeadLoop() after assert. 

In addition, the status of "AcpiProtocol->InstallAcpiTable" is overwritten before
it can be used in the function, it is better to check it before overwriting.

code: https://github.com/sunceping/edk2/tree/fixcoverityerrors.v1

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>

Ceping Sun (2):
  OvmfPkg/AcpiPlatformDxe: Avoid possible NULL pointer dereference
  OvmfPkg/AcpiPlatformDxe: Check the status to ensure no error

 OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109791): https://edk2.groups.io/g/devel/message/109791
Mute This Topic: https://groups.io/mt/102055422/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2023-10-19  6:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  6:21 sunceping [this message]
2023-10-19  6:21 ` [edk2-devel] [PATCH V1 1/2] OvmfPkg/AcpiPlatformDxe: Avoid possible NULL pointer dereference sunceping
2023-10-19  6:21 ` [edk2-devel] [PATCH V1 2/2] OvmfPkg/AcpiPlatformDxe: Check the status to ensure no error sunceping

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=20231019062142.417-1-cepingx.sun@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