From: Dandan Bi Date: Fri, 14 Aug 2015 01:06:48 +0000 (+0000) Subject: MdeModulePkg:Fix the issue that Commit changes and Exit fail when add driver option X-Git-Tag: edk2-stable201903~9065 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d6da3fb0b2ddeb4a76cb49de97594fc53d70f67d;p=mirror_edk2.git MdeModulePkg:Fix the issue that Commit changes and Exit fail when add driver option 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 Reviewed-by: Qiu Shumin Reviewed-by: Eric Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18220 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Application/UiApp/BootMaint/Variable.c b/MdeModulePkg/Application/UiApp/BootMaint/Variable.c index 8c10540854..2b594fcbd4 100644 --- a/MdeModulePkg/Application/UiApp/BootMaint/Variable.c +++ b/MdeModulePkg/Application/UiApp/BootMaint/Variable.c @@ -524,7 +524,6 @@ Var_UpdateErrorOutOption ( @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 @@ -660,13 +659,12 @@ Var_UpdateDriverOption ( 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); @@ -704,7 +702,6 @@ Var_UpdateDriverOption ( @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 @@ -829,13 +826,12 @@ Var_UpdateBootOption ( ); 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) {