summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 430da6429d..17e3bda967 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -199,6 +199,15 @@ PlatformRegisterFvBootOption (
);
ASSERT (DevicePath != NULL);
+ //
+ // File is not in firmware, so it is going to be deleted anyway by
+ // RemoveStaleFvFileOptions, let's not add it.
+ //
+ if (!FileIsInFv (DevicePath)) {
+ FreePool (DevicePath);
+ return;
+ }
+
Status = EfiBootManagerInitializeLoadOption (
&NewOption,
LoadOptionNumberUnassigned,