[edk2-devel] [PATCH] UefiCpuPkg/Universal/Acpi/S3Resume2Pei: Fix FORWARD_NULL Coverity issue

Ranbir Singh via groups.io posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 5 +++++
1 file changed, 5 insertions(+)
[edk2-devel] [PATCH] UefiCpuPkg/Universal/Acpi/S3Resume2Pei: Fix FORWARD_NULL Coverity issue
Posted by Ranbir Singh via groups.io 1 year, 4 months ago
The function S3ResumeExecuteBootScript at the point of preparing data
for return back makes a call to AllocatePool and stores the return
value in PeiS3ResumeState. Thereafter it does a check

if (PeiS3ResumeState == NULL) {

The if block further has ASSERT (FALSE); If PeiS3ResumeState is NULL,
then the if check passes and ASSERT hits, but this is applicable only
in DEBUG mode. In Release mode, the code comes out of this if block
and will dereference "PeiS3ResumeState" which will lead to CRASH.

Hence, for safety do not let the flow come out of the above if block.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4227
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
---
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
index e82f179569..b6b2e1f99c 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -884,6 +884,11 @@ S3ResumeExecuteBootScript (
(EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)
);
ASSERT (FALSE);
+    //
+    // Never run to here
+    //
+    CpuDeadLoop ();
+    return;
}

DEBUG ((DEBUG_INFO, "PeiS3ResumeState - %x\r\n", PeiS3ResumeState));
--
2.36.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97929): https://edk2.groups.io/g/devel/message/97929
Mute This Topic: https://groups.io/mt/96047568/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-