mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
For BdsDxe module,
1. Fix the risk that local variable is pointed by global pointer, which may be used outside the variable scope. 2. Add more checking for pointers. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10536 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
97ada49f31
commit
ce5fad4151
@ -1388,6 +1388,8 @@ BOpt_GetOptionNumber (
|
|||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
&OrderListSize
|
&OrderListSize
|
||||||
);
|
);
|
||||||
|
ASSERT (OrderList != NULL);
|
||||||
|
|
||||||
for (OptionNumber = 0; ; OptionNumber++) {
|
for (OptionNumber = 0; ; OptionNumber++) {
|
||||||
for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
|
for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
|
||||||
if (OptionNumber == OrderList[Index]) {
|
if (OptionNumber == OrderList[Index]) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Variable operation that will be used by bootmaint
|
Variable operation that will be used by bootmaint
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1162,6 +1162,8 @@ Var_UpdateBBSOption (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ASSERT (LegacyDeviceContext != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the Variable "LegacyDevOrder"
|
// Update the Variable "LegacyDevOrder"
|
||||||
//
|
//
|
||||||
|
@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
UINT16 mKeyInput;
|
UINT16 mKeyInput;
|
||||||
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
||||||
LIST_ENTRY *mBootOptionsList;
|
LIST_ENTRY mBootOptionsList;
|
||||||
BDS_COMMON_OPTION *gOption;
|
BDS_COMMON_OPTION *gOption;
|
||||||
|
|
||||||
HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = {
|
HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = {
|
||||||
@ -97,7 +97,7 @@ BootManagerCallback (
|
|||||||
//
|
//
|
||||||
KeyCount = 0;
|
KeyCount = 0;
|
||||||
|
|
||||||
for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {
|
for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {
|
||||||
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
||||||
|
|
||||||
KeyCount++;
|
KeyCount++;
|
||||||
@ -190,7 +190,6 @@ CallBootManager (
|
|||||||
UINTN ExitDataSize;
|
UINTN ExitDataSize;
|
||||||
EFI_STRING_ID Token;
|
EFI_STRING_ID Token;
|
||||||
EFI_INPUT_KEY Key;
|
EFI_INPUT_KEY Key;
|
||||||
LIST_ENTRY BdsBootOptionList;
|
|
||||||
CHAR16 *HelpString;
|
CHAR16 *HelpString;
|
||||||
EFI_STRING_ID HelpToken;
|
EFI_STRING_ID HelpToken;
|
||||||
UINT16 *TempStr;
|
UINT16 *TempStr;
|
||||||
@ -203,7 +202,7 @@ CallBootManager (
|
|||||||
EFI_IFR_GUID_LABEL *EndLabel;
|
EFI_IFR_GUID_LABEL *EndLabel;
|
||||||
|
|
||||||
gOption = NULL;
|
gOption = NULL;
|
||||||
InitializeListHead (&BdsBootOptionList);
|
InitializeListHead (&mBootOptionsList);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Connect all prior to entering the platform setup menu.
|
// Connect all prior to entering the platform setup menu.
|
||||||
@ -212,14 +211,8 @@ CallBootManager (
|
|||||||
BdsLibConnectAllDriversToAllControllers ();
|
BdsLibConnectAllDriversToAllControllers ();
|
||||||
gConnectAllHappened = TRUE;
|
gConnectAllHappened = TRUE;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// BugBug: Here we can not remove the legacy refresh macro, so we need
|
|
||||||
// get the boot order every time from "BootOrder" variable.
|
|
||||||
// Recreate the boot option list base on the BootOrder variable
|
|
||||||
//
|
|
||||||
BdsLibEnumerateAllBootOption (&BdsBootOptionList);
|
|
||||||
|
|
||||||
mBootOptionsList = &BdsBootOptionList;
|
BdsLibEnumerateAllBootOption (&mBootOptionsList);
|
||||||
|
|
||||||
HiiHandle = gBootManagerPrivate.HiiHandle;
|
HiiHandle = gBootManagerPrivate.HiiHandle;
|
||||||
|
|
||||||
@ -248,7 +241,7 @@ CallBootManager (
|
|||||||
|
|
||||||
mKeyInput = 0;
|
mKeyInput = 0;
|
||||||
|
|
||||||
for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {
|
for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {
|
||||||
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Provides a way for 3rd party applications to register themselves for launch by the
|
Provides a way for 3rd party applications to register themselves for launch by the
|
||||||
Boot Manager based on hot key
|
Boot Manager based on hot key
|
||||||
|
|
||||||
Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -132,6 +132,7 @@ RegisterHotkey (
|
|||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
&TempOptionSize
|
&TempOptionSize
|
||||||
);
|
);
|
||||||
|
ASSERT (TempOption != NULL);
|
||||||
|
|
||||||
if (CompareMem (TempOption, KeyOption, TempOptionSize) == 0) {
|
if (CompareMem (TempOption, KeyOption, TempOptionSize) == 0) {
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user