]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Do not assert when the device path node length is invalid.
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 23 Dec 2014 09:56:33 +0000 (09:56 +0000)
committerniruiyu <niruiyu@Edk2>
Tue, 23 Dec 2014 09:56:33 +0000 (09:56 +0000)
Because IsDevicePathValid() calls this API we should leave the device path validation in the caller.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16555 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c

index b73bcce07c14a5f50075cb9f1ad337716293932a..5cc4b35fe492e3ed9fddc40799a109add92684b7 100644 (file)
@@ -2,7 +2,7 @@
   Library instance that implement UEFI Device Path Library class based on protocol\r
   gEfiDevicePathUtilitiesProtocolGuid.\r
 \r
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -195,12 +195,8 @@ DevicePathNodeLength (
   IN CONST VOID  *Node\r
   )\r
 {\r
-  UINTN Length;\r
-\r
   ASSERT (Node != NULL);\r
-  Length = ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);\r
-  ASSERT (Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL));\r
-  return Length;\r
+  return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);\r
 }\r
 \r
 /**\r
@@ -567,8 +563,7 @@ GetNextDevicePathInstance (
   If there is not enough memory to allocate space for the new device path, then \r
   NULL is returned.  \r
   The memory is allocated from EFI boot services memory. It is the responsibility \r
-  of the caller to\r
-  free the memory allocated.\r
+  of the caller to free the memory allocated.\r
 \r
   @param  NodeType                   The device node type for the new device node.\r
   @param  NodeSubType                The device node sub-type for the new device node.\r