summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2014-07-28 05:55:10 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-28 05:55:10 +0000
commit37b971c590c4a3916c53bf23105e5f9d4ecdaaf3 (patch)
tree4e2a7032e21231dd7d89ad946dbd9f3f4d136f15
parent9afa7499df3139379b5b6553fd89d797a7ba3ded (diff)
downloadedk2-37b971c590c4a3916c53bf23105e5f9d4ecdaaf3.tar.gz
edk2-37b971c590c4a3916c53bf23105e5f9d4ecdaaf3.tar.bz2
edk2-37b971c590c4a3916c53bf23105e5f9d4ecdaaf3.zip
Sync patches r15544 and r15545 from main trunk.
1. Remove the assertion which may cause IsDevicePathValid() hang in DEBUG build. 2. Remove the RT attribute for HDDP variable and validate the variable content before using it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2014@15688 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c31
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c8
2 files changed, 26 insertions, 13 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 134833286f..db7a75098d 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -2526,11 +2526,28 @@ BdsExpandPartitionPartialDevicePathToFull (
// If exist, search the front path which point to partition node in the variable instants.
// If fail to find or HD_BOOT_DEVICE_PATH_VARIABLE_NAME not exist, reconnect all and search in all system
//
- CachedDevicePath = BdsLibGetVariableAndSize (
- HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
- &gHdBootDevicePathVariablGuid,
- &CachedDevicePathSize
- );
+ GetVariable2 (
+ HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
+ &gHdBootDevicePathVariablGuid,
+ (VOID **) &CachedDevicePath,
+ &CachedDevicePathSize
+ );
+
+ //
+ // Delete the invalid HD_BOOT_DEVICE_PATH_VARIABLE_NAME variable.
+ //
+ if ((CachedDevicePath != NULL) && !IsDevicePathValid (CachedDevicePath, CachedDevicePathSize)) {
+ FreePool (CachedDevicePath);
+ CachedDevicePath = NULL;
+ Status = gRT->SetVariable (
+ HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
+ &gHdBootDevicePathVariablGuid,
+ 0,
+ 0,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
if (CachedDevicePath != NULL) {
TempNewDevicePath = CachedDevicePath;
@@ -2593,7 +2610,7 @@ BdsExpandPartitionPartialDevicePathToFull (
Status = gRT->SetVariable (
HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
&gHdBootDevicePathVariablGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
GetDevicePathSize (CachedDevicePath),
CachedDevicePath
);
@@ -2692,7 +2709,7 @@ BdsExpandPartitionPartialDevicePathToFull (
Status = gRT->SetVariable (
HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
&gHdBootDevicePathVariablGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
GetDevicePathSize (CachedDevicePath),
CachedDevicePath
);
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
index b48bf02ae8..7f21a60380 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
@@ -8,7 +8,7 @@
environment varibles. Multi-instance device paths should never be placed
on a Handle.
- Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2014, 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
@@ -153,12 +153,8 @@ DevicePathNodeLength (
IN CONST VOID *Node
)
{
- UINTN Length;
-
ASSERT (Node != NULL);
- Length = ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
- ASSERT (Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL));
- return Length;
+ return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
}
/**