From nobody Sun May 19 01:15:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+97929+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97929+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1672827887; cv=none; d=zohomail.com; s=zohoarc; b=FS3UmKhRzTTUVCZ8XTuMDW3jV6fHYlJ5j6j1v19pkeG0AW8WqM6bZ17St+0XEJhyeVpd1CU6QvTWA7XFxgk8gDVaBCxyEGDfGMVSyHlIpE8YBWHX1xvNumZ8jegJlfZUVM2slcXDPKAjxBTMgglujtH/v9ky2cqBuDz/x5HAnws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672827887; h=Content-Type:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=EMEheG5cxRQ3su5DOkgIUrEQV6ms3btY9biZnUxVNRA=; b=HeRiaWkv/1ymHCP3THMJzd3SDPU1eJ8MV3SSRCGLi33REMfa0fUhpV++A2Rya+cRPXbsphCwGcnWxMoLSi1czReJBTtUpC3SIQY8UQPs2u0idyxU1TeTFhsR9kbRXKeLCYkEFjH7dsYiskqh8oN2YpVNJAJI1r3d6BFOL5XNI3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97929+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1672827887061784.9201898058855; Wed, 4 Jan 2023 02:24:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 30WoYY1788612xsAllYnwawx; Wed, 04 Jan 2023 02:24:46 -0800 Subject: [edk2-devel] [PATCH] UefiCpuPkg/Universal/Acpi/S3Resume2Pei: Fix FORWARD_NULL Coverity issue To: devel@edk2.groups.io From: "Ranbir Singh via groups.io" X-Originating-Location: Bengaluru, Karnataka, IN (122.172.85.38) X-Originating-Platform: Windows Chrome 108 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Wed, 04 Jan 2023 02:24:46 -0800 Message-ID: <7O3C.1672827886173827979.IrVv@groups.io> Precedence: Bulk List-Unsubscribe: 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,Ranbir.Singh3@Dell.com X-Gm-Message-State: gkSBoIpsOUpMBFiZunD5Uowpx1787277AA= Content-Type: multipart/alternative; boundary="eLGFJiRAFkaUU1zF5aSA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672827886; bh=kubJlcG/Soa50tjXdXdx4L0S3A597KrL2DKxvuF+OX4=; h=Content-Type:Date:From:Reply-To:Subject:To; b=kXrLe/BWkdBYfvtopjHKQ5kqZ2Ddjkb+K0D4GggYP86ZsAH11hJytjsd8k80Jubql9N ss47Fk7mugmMzEJCTIST3ENbz72+zk6GLc0KEqUcwjhfcDLvVIJxUHVd1GjolRY/Q/O/w 4Cx9INLN/VvSSgT5zkiA8948lN1FSFy94xI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672827887836100002 --eLGFJiRAFkaUU1zF5aSA Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 =3D=3D 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=3D4227 Signed-off-by: Ranbir Singh --- 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); +=C2=A0 =C2=A0 // +=C2=A0 =C2=A0 // Never run to here +=C2=A0 =C2=A0 // +=C2=A0 =C2=A0 CpuDeadLoop (); +=C2=A0 =C2=A0 return; } DEBUG ((DEBUG_INFO, "PeiS3ResumeState - %x\r\n", PeiS3ResumeState)); -- 2.36.1.windows.1 -=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 (#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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --eLGFJiRAFkaUU1zF5aSA Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
The function S3ResumeExecuteBootScript at the point of preparing data<= /div>
for return back makes a call to AllocatePool and stores the return
value in PeiS3ResumeState. Thereafter it does a check
 
    if (PeiS3ResumeState =3D=3D NULL) {
 
The if block further has ASSERT (FALSE); If PeiS3ResumeState is NULL,<= /div>
then the if check passes and ASSERT hits, but this is applicable only<= /div>
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.<= /div>
 
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4227
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/UefiC= puPkg/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", PeiS3Res= umeState));
--
2.36.1.windows.1
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

= View/Reply Online (#97929) | =20 | Mute = This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [importer@patchew.org]

_._,_._,_
--eLGFJiRAFkaUU1zF5aSA--