public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH V1 0/2] OvmfPkg/AcpiPlatformDxe: Fix the coverity errors
@ 2023-10-19  6:21 sunceping
  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
  0 siblings, 2 replies; 3+ messages in thread
From: sunceping @ 2023-10-19  6:21 UTC (permalink / raw)
  To: devel; +Cc: sunceping, Gerd Hoffmann, Jiewen Yao, Min Xu

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]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-19  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19  6:21 [edk2-devel] [PATCH V1 0/2] OvmfPkg/AcpiPlatformDxe: Fix the coverity errors sunceping
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox