When add driver option using file,input the description and then commit changes 
and exit,
it doesn't work.it caused by the commit 18216.When variable DriverOrderList in 
Variable.c
is NULL,it also need do the follow path,shouldn't return.Now change the code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <[email protected]>
---
 MdeModulePkg/Application/UiApp/BootMaint/Variable.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/MdeModulePkg/Application/UiApp/BootMaint/Variable.c 
b/MdeModulePkg/Application/UiApp/BootMaint/Variable.c
index 8c10540..2b594fc 100644
--- a/MdeModulePkg/Application/UiApp/BootMaint/Variable.c
+++ b/MdeModulePkg/Application/UiApp/BootMaint/Variable.c
@@ -522,11 +522,10 @@ Var_UpdateErrorOutOption (
   @param OptionalData    The optional load option.
   @param ForceReconnect  If to force reconnect.
 
   @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
   @retval EFI_SUCCESS          If function completes successfully.
-  @return Others Errors        Return errors from call to gRT->GetVariable.
 
 **/
 EFI_STATUS
 Var_UpdateDriverOption (
   IN  BMM_CALLBACK_DATA         *CallbackData,
@@ -658,17 +657,16 @@ Var_UpdateDriverOption (
                   VAR_FLAG,
                   BufferSize,
                   Buffer
                   );
   ASSERT_EFI_ERROR (Status);
-  Status = GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, 
&DriverOrderListSize);
-  if (EFI_ERROR (Status) || DriverOrderList == NULL){
-    return Status;
-  }
+  GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, 
&DriverOrderListSize);
   NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof 
(UINT16));
   ASSERT (NewDriverOrderList != NULL);
-  CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
+  if (DriverOrderList != NULL){
+    CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
+  }
   NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
   if (DriverOrderList != NULL) {
     EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
   }
 
@@ -702,11 +700,10 @@ Var_UpdateDriverOption (
   @param CallbackData    The BMM context data.
   @param NvRamMap        The file explorer formset internal state.
 
   @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
   @retval EFI_SUCCESS          If function completes successfully.
-  @return Others Errors        Return errors from call to gRT->GetVariable.
 
 **/
 EFI_STATUS
 Var_UpdateBootOption (
   IN  BMM_CALLBACK_DATA                   *CallbackData,
@@ -827,17 +824,16 @@ Var_UpdateBootOption (
                   BufferSize,
                   Buffer
                   );
   ASSERT_EFI_ERROR (Status);
 
-  Status = GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, 
&BootOrderListSize);
-  if (EFI_ERROR (Status) || BootOrderList == NULL){
-    return Status;
-  }
+  GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, 
&BootOrderListSize);
   NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
   ASSERT (NewBootOrderList != NULL);
-  CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
+  if (BootOrderList != NULL){
+    CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
+  }
   NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
 
   if (BootOrderList != NULL) {
     FreePool (BootOrderList);
   }
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to