Remove the ASSERT code that may be triggered in LegacyBootMaintUiLib. Cc: Liming Gao <[email protected]> Cc: Eric Dong <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <[email protected]> --- .../LegacyBootMaintUiLib/LegacyBootMaintUi.c | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c index 65d617c..c9d6ee4 100644 --- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c +++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c @@ -1,9 +1,9 @@ /** @file Legacy Boot Maintainence UI implementation. -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -107,12 +107,15 @@ HII_VENDOR_DEVICE_PATH mLegacyBootOptionHiiVendorDevicePath = { @param DevOrderCount Count of the BBS Index @param EnBootOption Callee allocated buffer containing the enabled Boot Option Numbers @param EnBootOptionCount Count of the enabled Boot Option Numbers @param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers @param DisBootOptionCount Count of the disabled Boot Option Numbers + + @return EFI_SUCCESS The function completed successfully. + @retval other Contain some error, details see the status return by gRT->SetVariable. **/ -VOID +EFI_STATUS OrderLegacyBootOption4SameType ( UINT16 *DevOrder, UINTN DevOrderCount, UINT16 **EnBootOption, UINTN *EnBootOptionCount, @@ -141,10 +144,11 @@ OrderLegacyBootOption4SameType ( *EnBootOption = AllocatePool (BootOrderSize); *DisBootOption = AllocatePool (BootOrderSize); *DisBootOptionCount = 0; *EnBootOptionCount = 0; Index = 0; + Status = EFI_SUCCESS; ASSERT (BbsIndexArray != NULL); ASSERT (DeviceTypeArray != NULL); ASSERT (*EnBootOption != NULL); ASSERT (*DisBootOption != NULL); @@ -205,27 +209,29 @@ OrderLegacyBootOption4SameType ( &gEfiGlobalVariableGuid, VAR_FLAG, BootOrderSize, BootOrder ); - ASSERT_EFI_ERROR (Status); FreePool (NewBootOption); FreePool (DeviceTypeArray); FreePool (BbsIndexArray); + + return Status; } /** Update the legacy BBS boot option. L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid is also updated. @param NVMapData The data for egacy BBS boot. @return EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can be found. + @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found. @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource + @retval other Contain some error, details see the status return by gRT->SetVariable. **/ EFI_STATUS UpdateBBSOption ( IN LEGACY_BOOT_NV_DATA *NVMapData ) @@ -258,10 +264,12 @@ UpdateBBSOption ( DisMap = NULL; NewOrder = NULL; CurrentType = 0; + EnBootOption = NULL; + DisBootOption = NULL; DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap; Status = EFI_SUCCESS; @@ -379,18 +387,21 @@ UpdateBBSOption ( // // 1. Re-order the Option Number in BootOrder according to Legacy Dev Order // ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1); - OrderLegacyBootOption4SameType ( + Status = OrderLegacyBootOption4SameType ( DevOrder->Data, DevOrder->Length / sizeof (UINT16) - 1, &EnBootOption, &EnBootOptionCount, &DisBootOption, &DisBootOptionCount ); + if (EFI_ERROR(Status)) { + goto Fail; + } // // 2. Deactivate the DisBootOption and activate the EnBootOption // for (Index = 0; Index < DisBootOptionCount; Index++) { @@ -444,10 +455,19 @@ UpdateBBSOption ( EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, VarSize, OriginalPtr ); +Fail: + if (EnBootOption != NULL) { + FreePool (EnBootOption); + } + + if (DisBootOption != NULL) { + FreePool (DisBootOption); + } + FreePool (OriginalPtr); return Status; } /** -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

