Fix issue from code scrub.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7349 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2009-01-23 03:32:01 +00:00
parent 9872985bb1
commit cb26370805
10 changed files with 65 additions and 79 deletions

View File

@ -138,6 +138,14 @@ BdsBootDeviceSelect (
// //
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext); UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
BootOption = BdsLibVariableToOption (&BootLists, Buffer); BootOption = BdsLibVariableToOption (&BootLists, Buffer);
//
// If fail to get boot option from variable, just return and do nothing.
//
if (BootOption == NULL) {
return;
}
BootOption->BootCurrent = *mBootNext; BootOption->BootCurrent = *mBootNext;
} }
// //

View File

@ -580,6 +580,7 @@ ApplyChangeHandler (
break; break;
case FORM_BOOT_DEL_ID: case FORM_BOOT_DEL_ID:
ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (UINT8)));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
@ -590,6 +591,7 @@ ApplyChangeHandler (
break; break;
case FORM_DRV_DEL_ID: case FORM_DRV_DEL_ID:
ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (UINT8)));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
@ -638,12 +640,16 @@ ApplyChangeHandler (
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate; NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate;
ASSERT (CurrentFakeNVMap->COMBaudRate < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value; NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value;
NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate; NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate;
ASSERT (CurrentFakeNVMap->COMDataRate < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value; NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value;
NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits; NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits;
ASSERT (CurrentFakeNVMap->COMStopBits < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value; NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value;
NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity; NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity;
ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0])));
NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value; NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType; NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
@ -658,6 +664,7 @@ ApplyChangeHandler (
break; break;
case FORM_CON_IN_ID: case FORM_CON_IN_ID:
ASSERT ((ConsoleInpMenu.MenuNumber + TerminalMenu.MenuNumber) <= (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8)));
for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) { for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
@ -674,6 +681,7 @@ ApplyChangeHandler (
break; break;
case FORM_CON_OUT_ID: case FORM_CON_OUT_ID:
ASSERT ((ConsoleOutMenu.MenuNumber + TerminalMenu.MenuNumber) <= (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8)));
for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) { for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
@ -690,6 +698,7 @@ ApplyChangeHandler (
break; break;
case FORM_CON_ERR_ID: case FORM_CON_ERR_ID:
ASSERT ((ConsoleErrMenu.MenuNumber + TerminalMenu.MenuNumber) <= (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8)));
for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) { for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
@ -752,12 +761,14 @@ DiscardChangeHandler (
break; break;
case FORM_BOOT_DEL_ID: case FORM_BOOT_DEL_ID:
ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
CurrentFakeNVMap->BootOptionDel[Index] = 0x00; CurrentFakeNVMap->BootOptionDel[Index] = 0x00;
} }
break; break;
case FORM_DRV_DEL_ID: case FORM_DRV_DEL_ID:
ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
CurrentFakeNVMap->DriverOptionDel[Index] = 0x00; CurrentFakeNVMap->DriverOptionDel[Index] = 0x00;
} }

View File

@ -847,7 +847,8 @@ BOpt_FreeLegacyOptions (
@param CallbackData The BMM context data. @param CallbackData The BMM context data.
@return The number of the Var Boot####. @return EFI_NOT_FOUND Fail to find "BootOrder" variable.
@return EFI_SUCESS Success build boot option menu.
**/ **/
EFI_STATUS EFI_STATUS
@ -892,6 +893,9 @@ BOpt_GetBootOptions (
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
&BootOrderListSize &BootOrderListSize
); );
if (BootOrderList == NULL) {
return EFI_NOT_FOUND;
}
// //
// Get the BootNext from the Var // Get the BootNext from the Var
@ -1067,7 +1071,7 @@ BOpt_GetBootOptions (
FreePool (BootOrderList); FreePool (BootOrderList);
} }
BootOptionMenu.MenuNumber = MenuCount; BootOptionMenu.MenuNumber = MenuCount;
return MenuCount; return EFI_SUCCESS;
} }
/** /**
@ -1493,9 +1497,9 @@ BOpt_GetDriverOptionNumber (
@param CallbackData The BMM context data. @param CallbackData The BMM context data.
@return EFI_SUCESS The functin completes successfully. @retval EFI_SUCESS The functin completes successfully.
@retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation. @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
@retval EFI_NOT_FOUND Fail to get "DriverOrder" variable.
**/ **/
EFI_STATUS EFI_STATUS
@ -1532,6 +1536,9 @@ BOpt_GetDriverOptions (
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
&DriverOrderListSize &DriverOrderListSize
); );
if (DriverOrderList == NULL) {
return EFI_NOT_FOUND;
}
for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) { for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
UnicodeSPrint ( UnicodeSPrint (

View File

@ -14,21 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "BootMaint.h" #include "BootMaint.h"
/**
Function creates a device path data structure that identically matches the
device path passed in.
@param DevPath A pointer to a device path data structure.
@return The new copy of DevPath is created to identically match the input.
@retval NULL Otherwise, NULL is returned.
**/
EFI_DEVICE_PATH_PROTOCOL *
DevicePathInstanceDup (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
);
/** /**
Update Com Ports attributes from DevicePath Update Com Ports attributes from DevicePath
@ -423,7 +408,7 @@ LocateSerialIo (
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32)); CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath); NewTerminalContext->DevicePath = DuplicateDevicePath (DevicePath);
// //
// BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system! // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
// coz' the misc data for each platform is not correct, actually it's the device path stored in // coz' the misc data for each platform is not correct, actually it's the device path stored in
@ -547,7 +532,6 @@ LocateSerialIo (
/** /**
Update Com Ports attributes from DevicePath Update Com Ports attributes from DevicePath
@param DevicePath DevicePath that contains Com ports @param DevicePath DevicePath that contains Com ports
@retval EFI_SUCCESS The update is successful. @retval EFI_SUCCESS The update is successful.
@ -665,54 +649,6 @@ UpdateComAttributeFromVariable (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Function creates a device path data structure that identically matches the
device path passed in.
@param DevPath A pointer to a device path data structure.
@return The new copy of DevPath is created to identically match the input.
@retval NULL Otherwise, NULL is returned.
**/
EFI_DEVICE_PATH_PROTOCOL *
DevicePathInstanceDup (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
{
EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
EFI_DEVICE_PATH_PROTOCOL *Temp;
UINT8 *Ptr;
UINTN Size;
//
// get the size of an instance from the input
//
Temp = DevPath;
DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
//
// Make a copy and set proper end type
//
NewDevPath = NULL;
if (Size != 0) {
NewDevPath = AllocateZeroPool (Size);
ASSERT (NewDevPath != NULL);
}
if (NewDevPath != NULL) {
CopyMem (NewDevPath, DevicePathInst, Size);
Ptr = (UINT8 *) NewDevPath;
Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);
Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
SetDevicePathEndNode (Temp);
}
return NewDevPath;
}
/** /**
Build up Console Menu based on types passed in. The type can Build up Console Menu based on types passed in. The type can
be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT
@ -818,7 +754,7 @@ GetConsoleMenu (
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
NewMenuEntry->OptionNumber = Index2; NewMenuEntry->OptionNumber = Index2;
NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst); NewConsoleContext->DevicePath = DuplicateDevicePath (DevicePathInst);
NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath); NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);
if (NULL == NewMenuEntry->DisplayString) { if (NULL == NewMenuEntry->DisplayString) {
NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath); NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);

View File

@ -162,6 +162,7 @@ BootThisFile (
BDS_COMMON_OPTION *Option; BDS_COMMON_OPTION *Option;
Option = (BDS_COMMON_OPTION *) AllocatePool (sizeof (BDS_COMMON_OPTION)); Option = (BDS_COMMON_OPTION *) AllocatePool (sizeof (BDS_COMMON_OPTION));
ASSERT (Option != NULL);
Option->Description = FileContext->FileName; Option->Description = FileContext->FileName;
Option->DevicePath = FileContext->DevicePath; Option->DevicePath = FileContext->DevicePath;
Option->LoadOptionsSize = 0; Option->LoadOptionsSize = 0;
@ -236,6 +237,7 @@ UpdateBootDelPage (
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu); CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionDel) / sizeof (CallbackData->BmmFakeNvData.BootOptionDel[0])));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
@ -317,6 +319,7 @@ UpdateDrvDelPage (
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu); CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);
ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionDel) / sizeof (CallbackData->BmmFakeNvData.DriverOptionDel[0])));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
@ -434,6 +437,7 @@ UpdateConsolePage (
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
ASSERT (ConsoleMenu->MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (CallbackData->BmmFakeNvData.ConsoleCheck[0])));
for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) { for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
@ -518,10 +522,11 @@ UpdateOrderPage (
ZeroMem (CallbackData->BmmFakeNvData.OptionOrder, 100); ZeroMem (CallbackData->BmmFakeNvData.OptionOrder, 100);
IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber); IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);
if (NULL == IfrOptionList) { if (IfrOptionList == NULL) {
return ; return ;
} }
ASSERT (OptionMenu->MenuNumber <= (sizeof (IfrOptionList) / sizeof (IfrOptionList[0])));
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) { for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken; IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
@ -736,12 +741,15 @@ UpdateConModePage (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
continue; continue;
} }
// //
// Build mode string Column x Row // Build mode string Column x Row
// //
UnicodeValueToString (ModeString, 0, Col, 0); UnicodeValueToString (ModeString, 0, Col, 0);
ASSERT ((StrLen (ModeString) + 1) < (sizeof (ModeString) / sizeof (ModeString[0])));
StrCat (ModeString, L" x "); StrCat (ModeString, L" x ");
UnicodeValueToString (RowString, 0, Row, 0); UnicodeValueToString (RowString, 0, Row, 0);
ASSERT ((StrLen (ModeString) + StrLen(RowString)) < (sizeof (ModeString) / sizeof (ModeString[0])));
StrCat (ModeString, RowString); StrCat (ModeString, RowString);
HiiLibNewString (CallbackData->BmmHiiHandle, &ModeToken[Index], ModeString); HiiLibNewString (CallbackData->BmmHiiHandle, &ModeToken[Index], ModeString);
@ -1024,6 +1032,10 @@ GetLegacyBootOptionVar (
&OrderSize &OrderSize
); );
if (OrderBuffer == NULL) {
return NULL;
}
for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) { for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {
UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]); UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);
OptionBuffer = BdsLibGetVariableAndSize ( OptionBuffer = BdsLibGetVariableAndSize (
@ -1177,6 +1189,9 @@ UpdateSetLegacyDeviceOrderPage (
OldData = CallbackData->BmmOldFakeNVData.LegacyBEV; OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
break; break;
default:
DEBUG ((EFI_D_ERROR, "Invalid command ID for updating page!\n"));
return;
} }
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu); CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);

View File

@ -437,6 +437,8 @@ Var_UpdateConsoleOption (
) { ) {
Vendor.Header.Type = MESSAGING_DEVICE_PATH; Vendor.Header.Type = MESSAGING_DEVICE_PATH;
Vendor.Header.SubType = MSG_VENDOR_DP; Vendor.Header.SubType = MSG_VENDOR_DP;
ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));
CopyMem ( CopyMem (
&Vendor.Guid, &Vendor.Guid,
&TerminalTypeGuid[NewTerminalContext->TerminalType], &TerminalTypeGuid[NewTerminalContext->TerminalType],
@ -977,6 +979,7 @@ Var_UpdateBootOrder (
FreePool (BootOrderList); FreePool (BootOrderList);
} }
ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (CallbackData->BmmFakeNvData.OptionOrder[0])));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewBootOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[Index] - 1); NewBootOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[Index] - 1);
} }
@ -1048,6 +1051,7 @@ Var_UpdateDriverOrder (
FreePool (DriverOrderList); FreePool (DriverOrderList);
} }
ASSERT (DriverOrderListSize <= (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (CallbackData->BmmFakeNvData.OptionOrder[0])));
for (Index = 0; Index < DriverOrderListSize; Index++) { for (Index = 0; Index < DriverOrderListSize; Index++) {
NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[Index] - 1); NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[Index] - 1);
} }

View File

@ -230,6 +230,7 @@ CallBootManager (
TempStr = DevicePathToStr (Option->DevicePath); TempStr = DevicePathToStr (Option->DevicePath);
TempSize = StrSize (TempStr); TempSize = StrSize (TempStr);
HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : ")); HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));
ASSERT (HelpString != NULL);
StrCat (HelpString, L"Device Path : "); StrCat (HelpString, L"Device Path : ");
StrCat (HelpString, TempStr); StrCat (HelpString, TempStr);

View File

@ -234,7 +234,7 @@ CallDeviceManager (
// Get all the Hii handles // Get all the Hii handles
// //
Status = HiiLibGetHiiHandles (&HandleBufferLength, &HiiHandles); Status = HiiLibGetHiiHandles (&HandleBufferLength, &HiiHandles);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status && (HiiHandles != NULL));
HiiHandle = gDeviceManagerPrivate.HiiHandle; HiiHandle = gDeviceManagerPrivate.HiiHandle;

View File

@ -308,7 +308,7 @@ UnregisterHotkey (
information for the key that was pressed. information for the key that was pressed.
@retval EFI_SUCCESS KeyData is successfully processed. @retval EFI_SUCCESS KeyData is successfully processed.
@return EFI_NOT_FOUND Fail to find boot option variable.
**/ **/
EFI_STATUS EFI_STATUS
HotkeyCallback ( HotkeyCallback (
@ -344,6 +344,7 @@ HotkeyCallback (
// //
// Is this Key Stroke we are waiting for? // Is this Key Stroke we are waiting for?
// //
ASSERT (Hotkey->WaitingKey < (sizeof (Hotkey->KeyData) / sizeof (Hotkey->KeyData[0])));
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey]; HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) && if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) && (KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
@ -389,6 +390,9 @@ HotkeyCallback (
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", Hotkey->BootOptionNumber); UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", Hotkey->BootOptionNumber);
BootOption = BdsLibVariableToOption (&BootLists, Buffer); BootOption = BdsLibVariableToOption (&BootLists, Buffer);
if (BootOption == NULL) {
return EFI_NOT_FOUND;
}
BootOption->BootCurrent = Hotkey->BootOptionNumber; BootOption->BootCurrent = Hotkey->BootOptionNumber;
BdsLibConnectDevicePath (BootOption->DevicePath); BdsLibConnectDevicePath (BootOption->DevicePath);

View File

@ -86,7 +86,7 @@ PlatformBdsShowProgress (
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) { } else if (UgaDraw != NULL) {
Status = UgaDraw->GetMode ( Status = UgaDraw->GetMode (
UgaDraw, UgaDraw,
&SizeOfX, &SizeOfX,