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:06 -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 A3D5718CB8EB; Tue, 17 Sep 2019 19:50:05 +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 603B8600C8; Tue, 17 Sep 2019 19:50:04 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Hao A Wu , Jian J Wang , Liming Gao Subject: [PATCH 10/35] MdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call Date: Tue, 17 Sep 2019 21:49:10 +0200 Message-Id: <20190917194935.24322-11-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.6.2 (mx1.redhat.com [10.5.110.63]); Tue, 17 Sep 2019 19:50:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable The HiiConstructConfigHdr() function takes the "DriverHandle" parameter i= n order to fetch the device path from it, and then turn the device path int= o 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 HiiConstructConfigHdr() should be the same driver handle, for matching routing. Currently we pass "Private->HiiHandle", which is clearly a typo, because it is the return value of HiiAddPackages(), and stands for the published HII package list. 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/PlatVarCleanupLib= .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 t= emplate // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a = Null-terminator. // - ConfigRequestHdr =3D HiiConstructConfigHdr (&mVariableCleanupHiiGuid= , 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 2.19.1.3.g30247aa5d201