mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +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,
|
||||
&OrderListSize
|
||||
);
|
||||
ASSERT (OrderList != NULL);
|
||||
|
||||
for (OptionNumber = 0; ; OptionNumber++) {
|
||||
for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
|
||||
if (OptionNumber == OrderList[Index]) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
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
|
||||
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
|
||||
@ -1162,6 +1162,8 @@ Var_UpdateBBSOption (
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT (LegacyDeviceContext != NULL);
|
||||
|
||||
//
|
||||
// Update the Variable "LegacyDevOrder"
|
||||
//
|
||||
|
@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
UINT16 mKeyInput;
|
||||
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
||||
LIST_ENTRY *mBootOptionsList;
|
||||
LIST_ENTRY mBootOptionsList;
|
||||
BDS_COMMON_OPTION *gOption;
|
||||
|
||||
HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = {
|
||||
@ -97,7 +97,7 @@ BootManagerCallback (
|
||||
//
|
||||
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);
|
||||
|
||||
KeyCount++;
|
||||
@ -190,7 +190,6 @@ CallBootManager (
|
||||
UINTN ExitDataSize;
|
||||
EFI_STRING_ID Token;
|
||||
EFI_INPUT_KEY Key;
|
||||
LIST_ENTRY BdsBootOptionList;
|
||||
CHAR16 *HelpString;
|
||||
EFI_STRING_ID HelpToken;
|
||||
UINT16 *TempStr;
|
||||
@ -203,7 +202,7 @@ CallBootManager (
|
||||
EFI_IFR_GUID_LABEL *EndLabel;
|
||||
|
||||
gOption = NULL;
|
||||
InitializeListHead (&BdsBootOptionList);
|
||||
InitializeListHead (&mBootOptionsList);
|
||||
|
||||
//
|
||||
// Connect all prior to entering the platform setup menu.
|
||||
@ -212,14 +211,8 @@ CallBootManager (
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
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;
|
||||
|
||||
@ -248,7 +241,7 @@ CallBootManager (
|
||||
|
||||
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);
|
||||
|
||||
//
|
||||
|
@ -2,7 +2,7 @@
|
||||
Provides a way for 3rd party applications to register themselves for launch by the
|
||||
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
|
||||
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
|
||||
@ -132,6 +132,7 @@ RegisterHotkey (
|
||||
&gEfiGlobalVariableGuid,
|
||||
&TempOptionSize
|
||||
);
|
||||
ASSERT (TempOption != NULL);
|
||||
|
||||
if (CompareMem (TempOption, KeyOption, TempOptionSize) == 0) {
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user