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

Ranbir Singh via groups.io Ranbir.Singh3=Dell.com at groups.io
Wed Jan 4 10:24:46 UTC 2023


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 at 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/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230104/076eaac4/attachment-0001.htm>


More information about the edk2-devel-archive mailing list