From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 17 Sep 2019 12:50:47 -0700 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 5A948307D848; Tue, 17 Sep 2019 19:50:47 +0000 (UTC) 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 1E08F600C4; Tue, 17 Sep 2019 19:50:45 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Benjamin You , Guo Dong , Maurice Ma Subject: [PATCH 35/35] UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls Date: Tue, 17 Sep 2019 21:49:35 +0200 Message-Id: <20190917194935.24322-36-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.48]); Tue, 17 Sep 2019 19:50:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable The last parameter of ReserveResourceInGcd() is "ImageHandle", forwarded in turn to gDS->AllocateMemorySpace() or gDS->AllocateIoSpace() as "owner= " image handle. But BlDxeEntryPoint() passes "SystemTable" as "ImageHandle". Compilers have not flagged it because EFI_HANDLE (the type of "ImageHandle") is unfortunately specified as (VOID*), and (EFI_SYSTEM_TABLE*) converts to (VOID*) silently. Hand the entry point function's "ImageHandle" parameter to ReserveResourceInGcd(). This fixes an actual bug. Cc: Benjamin You Cc: Guo Dong Cc: Maurice Ma Signed-off-by: Laszlo Ersek --- Notes: build-tested only UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/= BlSupportDxe/BlSupportDxe.c index bcee4cd9bc41..28dfc8fc5545 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -106,10 +106,10 @@ BlDxeEntryPoint ( // // Report MMIO/IO Resources // - Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,= 0xFEC00000, SIZE_4KB, 0, SystemTable); // IOAPIC + Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,= 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC ASSERT_EFI_ERROR (Status); =20 - Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,= 0xFED00000, SIZE_1KB, 0, SystemTable); // HPET + Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,= 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET ASSERT_EFI_ERROR (Status); =20 // --=20 2.19.1.3.g30247aa5d201