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: philmd@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 23 Sep 2019 08:08:10 -0700 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01DA769066 for ; Mon, 23 Sep 2019 15:08:10 +0000 (UTC) Received: by mail-wm1-f71.google.com with SMTP id j125so6846796wmj.6 for ; Mon, 23 Sep 2019 08:08:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a/3MpWzJ9rojMQmqe/2Hfm7gnyYV1SLo5ARUJZJ3Vi4=; b=AEKQLZwFxAmbDZCnOjDSF+T0ZNY/ewX8UXb7J6yVDTJj1F6k9MpzAzD3070RuCbiof BoGPi3SKxRYkf8YKj30D33zFQh4yzypBl34bcBcLhBvad8zdAG/SRo7Kx0/Q+j6nYlss BtQPeBStRhKSLob08ovLaeuZPcOT3kSbHqiyjuxIM4n/kdWgsHrvbDq0K9TpdPxBYeF2 GpdEXL2v1qvIIzUwAyZpnOCMT8SQiiySFAyWtNnUCIPl/QlgSHgmw8kETH7WPAppEbyG nN89g7yVjfKa0geXew++wvWcssf2nxiu7Sy9roXOUt93c2dPUxZAKBZ/PKRpPy0lUT5S F05g== X-Gm-Message-State: APjAAAV3b2ciaeOkYhvW576AIKiWRTAampwkSIm4jmqlbbXOFF2LKJbN PBrugofG+mRj9W24XsiDd6enrJJeKZqZxWaCIa1TZkPUqXl+NcRfw8Fg+B/1bGVWgiFrKyxCl3q VRkKF+/4gBCqwEg== X-Received: by 2002:adf:e908:: with SMTP id f8mr21425882wrm.210.1569251288804; Mon, 23 Sep 2019 08:08:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwZat38dS1sWN7jTbJ8/OxxZd6SFHOa3jGnXeA3cJCKZs3Uz+teoWqEmuAUMO5ERlAnIYdBQ== X-Received: by 2002:adf:e908:: with SMTP id f8mr21425874wrm.210.1569251288635; Mon, 23 Sep 2019 08:08:08 -0700 (PDT) Received: from [192.168.1.115] (240.red-88-21-68.staticip.rima-tde.net. [88.21.68.240]) by smtp.gmail.com with ESMTPSA id w18sm8480459wmc.9.2019.09.23.08.08.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Sep 2019 08:08:08 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 35/35] UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls To: devel@edk2.groups.io, lersek@redhat.com Cc: Benjamin You , Guo Dong , Maurice Ma References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-36-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <91544023-5e46-83a7-c749-84bfb0a28ccb@redhat.com> Date: Mon, 23 Sep 2019 17:08:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190917194935.24322-36-lersek@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 9/17/19 9:49 PM, Laszlo Ersek wrote: > 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. Wow very buggy, so I assume this is mostly dead code, right? > 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 = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, SystemTable); // IOAPIC > + Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC > ASSERT_EFI_ERROR (Status); > > - Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, SystemTable); // HPET > + Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET > ASSERT_EFI_ERROR (Status); > > // > Reviewed-by: Philippe Mathieu-Daude