Expand HD paths when checking for invalid options

This commit is contained in:
Jeremy Soller
2019-10-31 15:11:35 -06:00
committed by Tim Crawford
parent 6dff36c9b2
commit 74f2015276

View File

@@ -2964,6 +2964,7 @@ BdsDeleteAllInvalidEfiBootOption (
UINTN Index2; UINTN Index2;
UINT16 BootOption[BOOT_OPTION_MAX_CHAR]; UINT16 BootOption[BOOT_OPTION_MAX_CHAR];
EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath; EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
EFI_DEVICE_PATH_PROTOCOL *WorkingDevicePath;
UINT8 *TempPtr; UINT8 *TempPtr;
CHAR16 *Description; CHAR16 *Description;
BOOLEAN Corrupted; BOOLEAN Corrupted;
@@ -3018,6 +3019,24 @@ BdsDeleteAllInvalidEfiBootOption (
Index++; Index++;
continue; continue;
} }
//
// If it's Device Path that starts with a hard drive path, append it with the front part to compose a
// full device path
//
WorkingDevicePath = NULL;
if ((DevicePathType (OptionDevicePath) == MEDIA_DEVICE_PATH) &&
(DevicePathSubType (OptionDevicePath) == MEDIA_HARDDRIVE_DP)) {
WorkingDevicePath = BdsExpandPartitionPartialDevicePathToFull (
(HARDDRIVE_DEVICE_PATH *)OptionDevicePath
);
if (WorkingDevicePath != NULL) {
OptionDevicePath = WorkingDevicePath;
} else {
// Ensure unexpandable HD paths are removed
Corrupted = TRUE;
}
}
} }
if (Corrupted || !BdsLibIsValidEFIBootOptDevicePathExt (OptionDevicePath, FALSE, Description)) { if (Corrupted || !BdsLibIsValidEFIBootOptDevicePathExt (OptionDevicePath, FALSE, Description)) {