summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 01:39:27 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 01:39:27 +0000
commit90100178f9af53c16b0b95a10670380e91e42993 (patch)
treeef54a59b7df000957535942bbb9e1d84621fb5d9
parent2677c652e28c67427e9274285253cb1881adbf18 (diff)
downloadedk2-90100178f9af53c16b0b95a10670380e91e42993.tar.gz
sync patch r10536, r10564, r10786 from main trunk.
Add security check to make code run safe. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@11551 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c6
-rw-r--r--IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c4
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c2
-rw-r--r--IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c4
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c10
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c2
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c17
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c3
-rw-r--r--IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c4
9 files changed, 26 insertions, 26 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c
index 13375f0fbc..66014c0ff7 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c
@@ -1,7 +1,7 @@
/** @file
This file contains all helper functions on the ATAPI command
- Copyright (c) 2006 - 2008, Intel Corporation
+ Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. 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
@@ -554,7 +554,7 @@ AtapiInquiry (
ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
Packet.Inquiry.opcode = ATA_CMD_INQUIRY;
Packet.Inquiry.page_code = 0;
- Packet.Inquiry.allocation_length = sizeof (ATAPI_INQUIRY_DATA);
+ Packet.Inquiry.allocation_length = (UINT8) sizeof (ATAPI_INQUIRY_DATA);
InquiryData = AllocatePool (sizeof (ATAPI_INQUIRY_DATA));
if (InquiryData == NULL) {
@@ -790,7 +790,7 @@ AtapiRequestSense (
//
ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
Packet.RequestSence.opcode = ATA_CMD_REQUEST_SENSE;
- Packet.RequestSence.allocation_length = sizeof (ATAPI_REQUEST_SENSE_DATA);
+ Packet.RequestSence.allocation_length = (UINT8) sizeof (ATAPI_REQUEST_SENSE_DATA);
//
// initialize pointer
diff --git a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
index e9c5223305..92f3ad6d36 100644
--- a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
@@ -1,7 +1,7 @@
/** @file
Report Status Code Library for DXE Phase.
- Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -535,7 +535,7 @@ ReportStatusCodeEx (
//
// Fill in the extended data header
//
- StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
+ StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
StatusCodeData->Size = (UINT16)ExtendedDataSize;
if (ExtendedDataGuid == NULL) {
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
index 6636b73f74..09c778e556 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
@@ -499,7 +499,7 @@ BdsLibVariableToOption (
// Unicode stream to ASCII without any loss in meaning.
//
if (*VariableName == 'B') {
- NumOff = sizeof (L"Boot")/sizeof(CHAR16) -1 ;
+ NumOff = (UINT8) (sizeof (L"Boot") / sizeof(CHAR16) - 1);
Option->BootCurrent = (UINT16) ((VariableName[NumOff] -'0') * 0x1000);
Option->BootCurrent = (UINT16) (Option->BootCurrent + ((VariableName[NumOff+1]-'0') * 0x100));
Option->BootCurrent = (UINT16) (Option->BootCurrent + ((VariableName[NumOff+2]-'0') * 0x10));
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
index 2006794529..fea684a267 100644
--- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
@@ -1,7 +1,7 @@
/** @file
API implementation for instance of Report Status Code Library.
- Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -401,7 +401,7 @@ ReportStatusCodeEx (
//
// Fill in the extended data header
//
- mStatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
+ mStatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
mStatusCodeData->Size = (UINT16)ExtendedDataSize;
if (ExtendedDataGuid == NULL) {
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
index d564f5c7d2..b11cecb55c 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
@@ -1380,6 +1380,7 @@ BOpt_GetOptionNumber (
OrderListSize = 0;
OrderList = NULL;
OptionNumber = 0;
+ Index = 0;
UnicodeSPrint (StrTemp, sizeof (StrTemp), L"%sOrder", Type);
@@ -1388,10 +1389,13 @@ BOpt_GetOptionNumber (
&gEfiGlobalVariableGuid,
&OrderListSize
);
+
for (OptionNumber = 0; ; OptionNumber++) {
- for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
- if (OptionNumber == OrderList[Index]) {
- break;
+ if (OrderList != NULL) {
+ for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
+ if (OptionNumber == OrderList[Index]) {
+ break;
+ }
}
}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
index 6bdcee41d5..90a44f0aea 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
@@ -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 b93655b3c7..a1f5c022b7 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 = {
@@ -104,7 +104,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++;
@@ -197,7 +197,6 @@ CallBootManager (
UINTN ExitDataSize;
EFI_STRING_ID Token;
EFI_INPUT_KEY Key;
- LIST_ENTRY BdsBootOptionList;
CHAR16 *HelpString;
EFI_STRING_ID HelpToken;
UINT16 *TempStr;
@@ -210,7 +209,7 @@ CallBootManager (
EFI_IFR_GUID_LABEL *EndLabel;
gOption = NULL;
- InitializeListHead (&BdsBootOptionList);
+ InitializeListHead (&mBootOptionsList);
//
// Connect all prior to entering the platform setup menu.
@@ -219,14 +218,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;
@@ -255,7 +248,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 99c3306ec9..1936ab5cf9 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. <BR>
+Copyright (c) 2007 - 2010, Intel Corporation. <BR>
All rights reserved. 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) {
//
diff --git a/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c b/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
index d1436a3273..d80ca4051d 100644
--- a/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
+++ b/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
@@ -2,7 +2,7 @@
This code produces the Data Hub protocol. It preloads the data hub
with status information copied in from PEI HOBs.
-Copyright (c) 2006 - 2009, Intel Corporation
+Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. 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
@@ -99,7 +99,7 @@ DataHubLogData (
// Build Standard Log Header
//
Record->Version = EFI_DATA_RECORD_HEADER_VERSION;
- Record->HeaderSize = sizeof (EFI_DATA_RECORD_HEADER);
+ Record->HeaderSize = (UINT16) sizeof (EFI_DATA_RECORD_HEADER);
Record->RecordSize = RecordSize;
CopyMem (&Record->DataRecordGuid, DataRecordGuid, sizeof (EFI_GUID));
CopyMem (&Record->ProducerName, ProducerName, sizeof (EFI_GUID));