From nobody Mon Feb 9 14:33:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47421+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47421+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568749847; cv=none; d=zoho.com; s=zohoarc; b=EtBSrMjeG8NS/RAeGoWQcjQ2LKLTBlP5NGNIpk0OOQ6l1d+WuACSu2FUOuXybZ8ENIInhWQiGpVKn7/SGP2ZdIY1jW7/df01gVpG7m962fpUOHpb6eWfedR6jYfQU8A5/paxhPxk5f9hslytRFUeQCJMovhW5UrsREaK/I4Yu6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568749847; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=V9eTHCDQK9hRn4bOil6KDwTk2ZA+7Ek3v/Sn6YVGVmc=; b=de8DDgBuLtn1+x3wUHpjeiokbMMuzOorQ4k7RQWl8YNfz9JPcYZKZVVSRSacpqSITeemAosg7Dv5RkqWGOptInYqg15INhPeh1h6Md7riyXjUakBvL4S7ETkJknCMFJHwDk6vrnOUTKWxHciUkjOSjNGyv9QcGQLgH1FfaqyIbI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47421+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15687498476591008.541882403446; Tue, 17 Sep 2019 12:50:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hFBPYY1788612xHxIkLZe6FV; Tue, 17 Sep 2019 12:50:46 -0700 X-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 17 Sep 2019 12:50:46 -0700 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B755830821AE; Tue, 17 Sep 2019 19:50:45 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-37.rdu2.redhat.com [10.10.120.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77B11600C8; Tue, 17 Sep 2019 19:50:44 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Benjamin You , Guo Dong , Maurice Ma Subject: [edk2-devel] [PATCH 34/35] UefiPayloadPkg/BlSupportPei: fix MMCONFIG assignment from XSDT Date: Tue, 17 Sep 2019 21:49:34 +0200 Message-Id: <20190917194935.24322-35-lersek@redhat.com> In-Reply-To: <20190917194935.24322-1-lersek@redhat.com> References: <20190917194935.24322-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 17 Sep 2019 19:50:45 +0000 (UTC) Precedence: Bulk List-Unsubscribe: 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,lersek@redhat.com X-Gm-Message-State: b4CxuRH9lKYthNuArykDRA8qx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568749846; bh=ibME326w3lg0uEX9oDm5jUyyvJQtSUhnVMSoKiSWbKY=; h=Cc:Date:From:Reply-To:Subject:To; b=Q1NxrBimAaMO2Ybzq98pl/NCmZuGL2m+0gAIH0f6Q7jvzORuFL7RSLuExoTaML1tkHC lpyu7EJziDSZGcn/4U4sgzg8XUr/APWbHlTXYWspxFsjhWKdRfJPU5YHtR+7Xb67Xy3q0 3SDff6oN70R6tXb7X7Mx50QzbrxaRJm3FEs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" (This patch is unrelated to the rest of this series; its purpose is to enable building the UefiPayloadPkg DSC files with GCC.) When building "UefiPayloadPkg/UefiPayloadPkgIa32.dsc" with GCC48 for the DEBUG target, the compiler reports that "Entry32" may be used uninitialized in ParseAcpiInfo(), in the XSDT branch. Code inspection proves the compiler right. In the XSDT branch, the code from the RSDT branch must have been duplicated, and "Entry32" references were replaced with "Entry64" -- except where "MmCfgHdr" is assigned. Fix this bug by introducing a helper variable called "Signature", so that we have to refer to "Entry32" or "Entry64" only once per loop body. Cc: Benjamin You Cc: Guo Dong Cc: Maurice Ma Signed-off-by: Laszlo Ersek Reviewed-by: Guo Dong Reviewed-by: Philippe Mathieu-Daude --- Notes: build-tested only UefiPayloadPkg/BlSupportPei/BlSupportPei.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/UefiPayloadPkg/BlSupportPei/BlSupportPei.c b/UefiPayloadPkg/Bl= SupportPei/BlSupportPei.c index 90433b609f22..22972453117a 100644 --- a/UefiPayloadPkg/BlSupportPei/BlSupportPei.c +++ b/UefiPayloadPkg/BlSupportPei/BlSupportPei.c @@ -164,6 +164,7 @@ ParseAcpiInfo ( UINT64 *Entry64; UINTN Entry64Num; UINTN Idx; + UINT32 *Signature; EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr; EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCAT= ION_STRUCTURE *MmCfgBase; =20 @@ -181,13 +182,14 @@ ParseAcpiInfo ( Entry32 =3D (UINT32 *)(Rsdt + 1); Entry32Num =3D (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 2; for (Idx =3D 0; Idx < Entry32Num; Idx++) { - if (*(UINT32 *)(UINTN)(Entry32[Idx]) =3D=3D EFI_ACPI_3_0_FIXED_ACPI_= DESCRIPTION_TABLE_SIGNATURE) { - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entr= y32[Idx]); + Signature =3D (UINT32 *)(UINTN)Entry32[Idx]; + if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) { + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature; DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n")); } =20 - if (*(UINT32 *)(UINTN)(Entry32[Idx]) =3D=3D EFI_ACPI_5_0_PCI_EXPRESS= _MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE= ) { - MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)(UINTN)(Entry32[Idx]); + if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { + MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature; DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n")); } =20 @@ -205,13 +207,14 @@ ParseAcpiInfo ( Entry64 =3D (UINT64 *)(Xsdt + 1); Entry64Num =3D (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 3; for (Idx =3D 0; Idx < Entry64Num; Idx++) { - if (*(UINT32 *)(UINTN)(Entry64[Idx]) =3D=3D EFI_ACPI_3_0_FIXED_ACPI_= DESCRIPTION_TABLE_SIGNATURE) { - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entr= y64[Idx]); + Signature =3D (UINT32 *)(UINTN)Entry64[Idx]; + if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) { + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature; DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n")); } =20 - if (*(UINT32 *)(UINTN)(Entry64[Idx]) =3D=3D EFI_ACPI_5_0_PCI_EXPRESS= _MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE= ) { - MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)(UINTN)(Entry32[Idx]); + if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { + MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature; DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n")); } =20 --=20 2.19.1.3.g30247aa5d201 -=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 (#47421): https://edk2.groups.io/g/devel/message/47421 Mute This Topic: https://groups.io/mt/34180239/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-