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, 24 Sep 2019 10:28:08 -0700 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7295010DCC93; Tue, 24 Sep 2019 17:28:07 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-118.rdu2.redhat.com [10.10.120.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 019CE5D9D5; Tue, 24 Sep 2019 17:28:03 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 10/35] MdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , devel@edk2.groups.io Cc: Hao A Wu , Jian J Wang , Liming Gao References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-11-lersek@redhat.com> From: "Laszlo Ersek" Message-ID: <9ae55f7c-2435-b906-785d-c9e2a5271683@redhat.com> Date: Tue, 24 Sep 2019 19:28:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Tue, 24 Sep 2019 17:28:07 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 09/23/19 13:45, Philippe Mathieu-Daud=C3=A9 wrote: > On 9/17/19 9:49 PM, Laszlo Ersek wrote: >> The HiiConstructConfigHdr() function takes the "DriverHandle" paramete= r in >> order to fetch the device path from it, and then turn the device path = into >> PATH routing information. >> >> The HiiConstructConfigHdr() function is called from >> VariableCleanupHiiExtractConfig(), which is only installed when "Type"= is >> "VarCleanupManually" in PlatformVarCleanup(). >> >> In that case, we create "Private->DriverHandle" as a new handle, and >> install "mVarCleanupHiiVendorDevicePath" on it. Then we pass >> "Private->DriverHandle" to HiiAddPackages(), which consumes the device >> path for routing purposes. >> >> It follows that the "DriverHandle" argument pased to >=20 > "passed" Good catch, thanks! (For the other reviews as well, of course!) Laszlo >=20 >> HiiConstructConfigHdr() should be the same driver handle, for matching >> routing. >> >> Currently we pass "Private->HiiHandle", which is clearly a typo, becau= se >> it is the return value of HiiAddPackages(), and stands for the publish= ed >> HII package list. >=20 > Phew... >=20 >> Therefore this patch addresses an actual bug. >> >> The typo has not been flagged by compilers because the UEFI spec >> regrettably defines both EFI_HANDLE and EFI_HII_HANDLE as (VOID*). >> >> Cc: Hao A Wu >> Cc: Jian J Wang >> Cc: Liming Gao >> Signed-off-by: Laszlo Ersek >> --- >> >> Notes: >> build-tested only >> >> MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c | 6 ++= +++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanup= Lib.c b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c >> index 968c044a316a..3875d614bb41 100644 >> --- a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c >> +++ b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c >> @@ -609,7 +609,11 @@ VariableCleanupHiiExtractConfig ( >> // Allocate and fill a buffer large enough to hold the template >> // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by= a Null-terminator. >> // >> - ConfigRequestHdr =3D HiiConstructConfigHdr (&mVariableCleanupHiiG= uid, mVarStoreName, Private->HiiHandle); >> + ConfigRequestHdr =3D HiiConstructConfigHdr ( >> + &mVariableCleanupHiiGuid, >> + mVarStoreName, >> + Private->DriverHandle >> + ); >> Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); >> ConfigRequest =3D AllocateZeroPool (Size); >> ASSERT (ConfigRequest !=3D NULL); >> >=20 > Reviewed-by: Philippe Mathieu-Daude >=20