Added error control for invalid device handle when LocateDevicePath() 
fails. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov <daniil.egra...@arm.com>
---
 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 68b32f3..330d6b5 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -3626,7 +3626,11 @@ BdsLibGetBootableHandle (
       //
       UpdatedDevicePath = DevicePath;
       Status            = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, 
&UpdatedDevicePath, &Handle);
-      gBS->ConnectController (Handle, NULL, NULL, TRUE);
+      if (!EFI_ERROR (Status)) {
+        gBS->ConnectController (Handle, NULL, NULL, TRUE);
+      } else {
+        return (EFI_HANDLE) NULL;
+      }
     }
   } else {
     //
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to