mirror of https://github.com/acidanthera/audk.git
Fix some issues reported by source static analysis tools.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8785 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ee09c93f45
commit
b7b0dca207
|
@ -702,19 +702,17 @@ ApplyChangeHandler (
|
|||
break;
|
||||
|
||||
case FORM_CON_IN_ID:
|
||||
for (Index = 0;
|
||||
((Index < ConsoleInpMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8))));
|
||||
Index++) {
|
||||
for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
|
||||
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index < MAX_MENU_NUMBER);
|
||||
NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
|
||||
}
|
||||
|
||||
for (Index = 0;
|
||||
((Index < TerminalMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8) - ConsoleInpMenu.MenuNumber)));
|
||||
Index++) {
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);
|
||||
NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];
|
||||
}
|
||||
|
||||
|
@ -722,19 +720,17 @@ ApplyChangeHandler (
|
|||
break;
|
||||
|
||||
case FORM_CON_OUT_ID:
|
||||
for (Index = 0;
|
||||
((Index < ConsoleOutMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8))));
|
||||
Index++) {
|
||||
for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
|
||||
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index < MAX_MENU_NUMBER);
|
||||
NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
|
||||
}
|
||||
|
||||
for (Index = 0;
|
||||
((Index < TerminalMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8) - ConsoleOutMenu.MenuNumber)));
|
||||
Index++) {
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);
|
||||
NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];
|
||||
}
|
||||
|
||||
|
@ -742,20 +738,17 @@ ApplyChangeHandler (
|
|||
break;
|
||||
|
||||
case FORM_CON_ERR_ID:
|
||||
ASSERT ((ConsoleErrMenu.MenuNumber + TerminalMenu.MenuNumber) <= (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8)));
|
||||
for (Index = 0;
|
||||
((Index < ConsoleErrMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8))));
|
||||
Index++) {
|
||||
for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
|
||||
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index < MAX_MENU_NUMBER);
|
||||
NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
|
||||
}
|
||||
|
||||
for (Index = 0;
|
||||
((Index < TerminalMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->ConsoleCheck) / sizeof (UINT8) - ConsoleErrMenu.MenuNumber)));
|
||||
Index++) {
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);
|
||||
NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
// End Label
|
||||
//
|
||||
#define LABEL_END 0xffff
|
||||
#define MAX_MENU_NUMBER 100
|
||||
|
||||
///
|
||||
/// This is the structure that will be used to store the
|
||||
|
@ -124,8 +125,8 @@ typedef struct {
|
|||
//
|
||||
// Driver Option Add Handle page storage
|
||||
//
|
||||
UINT16 DriverAddHandleDesc[100];
|
||||
UINT16 DriverAddHandleOptionalData[100];
|
||||
UINT16 DriverAddHandleDesc[MAX_MENU_NUMBER];
|
||||
UINT16 DriverAddHandleOptionalData[MAX_MENU_NUMBER];
|
||||
UINT8 DriverAddActive;
|
||||
UINT8 DriverAddForceReconnect;
|
||||
|
||||
|
@ -142,19 +143,19 @@ typedef struct {
|
|||
//
|
||||
// At most 100 input/output/errorout device for console storage
|
||||
//
|
||||
UINT8 ConsoleCheck[100];
|
||||
UINT8 ConsoleCheck[MAX_MENU_NUMBER];
|
||||
|
||||
//
|
||||
// Boot or Driver Option Order storage
|
||||
//
|
||||
UINT8 OptionOrder[100];
|
||||
UINT8 DriverOptionToBeDeleted[100];
|
||||
UINT8 OptionOrder[MAX_MENU_NUMBER];
|
||||
UINT8 DriverOptionToBeDeleted[MAX_MENU_NUMBER];
|
||||
|
||||
//
|
||||
// Boot Option Delete storage
|
||||
//
|
||||
UINT8 BootOptionDel[100];
|
||||
UINT8 DriverOptionDel[100];
|
||||
UINT8 BootOptionDel[MAX_MENU_NUMBER];
|
||||
UINT8 DriverOptionDel[MAX_MENU_NUMBER];
|
||||
|
||||
//
|
||||
// This is the Terminal Attributes value storage
|
||||
|
@ -168,11 +169,11 @@ typedef struct {
|
|||
//
|
||||
// Legacy Device Order Selection Storage
|
||||
//
|
||||
UINT8 LegacyFD[100];
|
||||
UINT8 LegacyHD[100];
|
||||
UINT8 LegacyCD[100];
|
||||
UINT8 LegacyNET[100];
|
||||
UINT8 LegacyBEV[100];
|
||||
UINT8 LegacyFD[MAX_MENU_NUMBER];
|
||||
UINT8 LegacyHD[MAX_MENU_NUMBER];
|
||||
UINT8 LegacyCD[MAX_MENU_NUMBER];
|
||||
UINT8 LegacyNET[MAX_MENU_NUMBER];
|
||||
UINT8 LegacyBEV[MAX_MENU_NUMBER];
|
||||
|
||||
//
|
||||
// We use DisableMap array to record the enable/disable state of each boot device
|
||||
|
|
|
@ -490,6 +490,7 @@ UpdateConsolePage (
|
|||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
|
||||
ASSERT (Index < MAX_MENU_NUMBER);
|
||||
if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||
|
||||
((NewTerminalContext->IsConOut != 0) && (UpdatePageId == FORM_CON_OUT_ID)) ||
|
||||
((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID))
|
||||
|
@ -755,6 +756,7 @@ UpdateConModePage (
|
|||
UINTN Row;
|
||||
CHAR16 RowString[50];
|
||||
CHAR16 ModeString[50];
|
||||
CHAR16 *pStr;
|
||||
UINTN TempStringLen;
|
||||
UINTN MaxMode;
|
||||
UINTN ValidMode;
|
||||
|
@ -811,11 +813,11 @@ UpdateConModePage (
|
|||
// Build mode string Column x Row
|
||||
//
|
||||
TempStringLen = UnicodeValueToString (ModeString, 0, Col, 0);
|
||||
ASSERT ((TempStringLen + StrLen (L" x ")) < (sizeof (ModeString) / sizeof (ModeString[0])));
|
||||
StrCat (ModeString, L" x ");
|
||||
pStr = &ModeString[0];
|
||||
StrnCat (pStr, L" x ", StrLen(L" x "));
|
||||
TempStringLen = UnicodeValueToString (RowString, 0, Row, 0);
|
||||
ASSERT ((StrLen (ModeString) + TempStringLen) < (sizeof (ModeString) / sizeof (ModeString[0])));
|
||||
StrCat (ModeString, RowString);
|
||||
pStr = &ModeString[0];
|
||||
StrnCat (pStr, RowString, StrLen(RowString));
|
||||
|
||||
ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);
|
||||
|
||||
|
|
|
@ -273,7 +273,6 @@ CallBootManager (
|
|||
if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {
|
||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;
|
||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
|
||||
|
||||
} else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {
|
||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;
|
||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
|
||||
|
@ -299,6 +298,7 @@ CallBootManager (
|
|||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NON_BLOCK));
|
||||
}
|
||||
|
||||
ASSERT (Option->Description != NULL);
|
||||
if (StrnCmp (BootStringNumber, L"0", 1) != 0) {
|
||||
StrCat (Option->Description, L" ");
|
||||
StrCat (Option->Description, BootStringNumber);
|
||||
|
|
Loading…
Reference in New Issue