summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 028edc35d5..3691c116a9 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1501,9 +1501,18 @@ BmGetLoadOptionBuffer (
// Directly reads the load option when it doesn't reside in simple file system instance (LoadFile/LoadFile2),
// or it directly points to a file in simple file system instance.
//
+ Node = FilePath;
+ Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &Node, &Handle);
FileBuffer = GetFileBufferByFilePath (TRUE, FilePath, FileSize, &AuthenticationStatus);
if (FileBuffer != NULL) {
- *FullPath = DuplicateDevicePath (FilePath);
+ if (EFI_ERROR (Status)) {
+ *FullPath = DuplicateDevicePath (FilePath);
+ } else {
+ //
+ // LoadFile () may cause the device path of the Handle be updated.
+ //
+ *FullPath = AppendDevicePath (DevicePathFromHandle (Handle), Node);
+ }
}
return FileBuffer;