summaryrefslogtreecommitdiffstats
path: root/IntelFrameworkModulePkg/Universal/BdsDxe
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-21 07:40:24 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-21 07:40:24 +0000
commitce5fad41516804f34d52ebb27808255e1263fd0e (patch)
treef8becb5cb1aa0cac7903a53a71114b67b9a11d96 /IntelFrameworkModulePkg/Universal/BdsDxe
parent97ada49f3181ec678dddd25a35437164049793da (diff)
downloadedk2-ce5fad41516804f34d52ebb27808255e1263fd0e.tar.gz
edk2-ce5fad41516804f34d52ebb27808255e1263fd0e.tar.bz2
edk2-ce5fad41516804f34d52ebb27808255e1263fd0e.zip
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
Diffstat (limited to 'IntelFrameworkModulePkg/Universal/BdsDxe')
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c2
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c4
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c17
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c3
4 files changed, 12 insertions, 14 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
index 0eb30f0d31..1ca93fd886 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
@@ -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]) {
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
index 2ae2f96689..c7d6bc4ad1 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
@@ -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"
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
index 01ff5f88ad..da291000bc 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
@@ -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);
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
index b6cf4539af..da0a2eef5a 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
@@ -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) {
//