summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2019-09-07 11:48:58 +0200
committerLaszlo Ersek <lersek@redhat.com>2019-10-09 09:40:09 +0200
commit0bee7dbd2b02aaa53352c544c7c53d20ea9160a9 (patch)
tree2a1545a68ee1cb0c169bf9c2d4b22f08c2b3be93
parent10eec5aa92973ffe4e29de3a20cdddae0f1117f5 (diff)
downloadedk2-0bee7dbd2b02aaa53352c544c7c53d20ea9160a9.tar.gz
edk2-0bee7dbd2b02aaa53352c544c7c53d20ea9160a9.tar.bz2
edk2-0bee7dbd2b02aaa53352c544c7c53d20ea9160a9.zip
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 <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
-rw-r--r--MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c6
1 files changed, 5 insertions, 1 deletions
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 <ConfigHdr> 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);