Reviewed-by: Liming Gao <liming....@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Eric Dong
Sent: Wednesday, December 16, 2015 11:01 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch v2] BootManagerLib: Check the pointer to avoid use NULL 
pointer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.d...@intel.com>
---
 MdeModulePkg/Library/BootManagerLib/BootManager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdeModulePkg/Library/BootManagerLib/BootManager.c 
b/MdeModulePkg/Library/BootManagerLib/BootManager.c
index cfeedeb..dd87250 100644
--- a/MdeModulePkg/Library/BootManagerLib/BootManager.c
+++ b/MdeModulePkg/Library/BootManagerLib/BootManager.c
@@ -325,10 +325,13 @@ GroupMultipleLegacyBootOption4SameType (
   EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
 
   SetMem (DeviceTypeIndex, sizeof (DeviceTypeIndex), 0xff);
 
   GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);
+  if (BootOrder == NULL) {
+    return;
+  }
 
   for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
     UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", 
BootOrder[Index]);
     Status = EfiBootManagerVariableToLoadOption (OptionName, &BootOption);
     ASSERT_EFI_ERROR (Status);
-- 
2.6.4.windows.1

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

Reply via email to