From 0bee7dbd2b02aaa53352c544c7c53d20ea9160a9 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sat, 7 Sep 2019 11:48:58 +0200 Subject: MdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call The HiiConstructConfigHdr() function takes the "DriverHandle" parameter 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 passed 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 Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Hao A Wu --- 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 968c044a31..3875d614bb 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=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator. // - ConfigRequestHdr = HiiConstructConfigHdr (&mVariableCleanupHiiGuid, mVarStoreName, Private->HiiHandle); + ConfigRequestHdr = HiiConstructConfigHdr ( + &mVariableCleanupHiiGuid, + mVarStoreName, + Private->DriverHandle + ); Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); ConfigRequest = AllocateZeroPool (Size); ASSERT (ConfigRequest != NULL); -- cgit v1.2.3