summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-03-23 13:09:45 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-03-23 13:11:32 +0800
commit647636e1750b07110ed807f455cb9c8b7d089f75 (patch)
tree419694eedf0c49ed821b93ba814d46b07ca30726 /MdePkg
parent6ca29fa310d49dd0b224357de7990fd775b61d18 (diff)
MdePkg/DevicePathLib: Fix FromText bug for multi-instance devicepath
UefiDevicePathLibConvertTextToDevicePath correctly detects when it has hit a ',' splicing together multiple paths. However, the code that tries to cope with it: {code} if (IsInstanceEnd) { DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool ( END_DEVICE_PATH_LENGTH); ASSERT (DeviceNode != NULL); SetDevicePathEndNode (DeviceNode); NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode); FreePool (DevicePath); FreePool (DeviceNode); DevicePath = NewDevicePath; } {code} causes a problem. The END node that's appended it the node for the entire list. So when the node is appended in AppendDevicePathNode, it winds up disappearing. This leads to the path 'PciRoot(0x0),PciRoot(0x0)' parsing as if 'PciRoot(0x0)/PciRoot(0x0)' were specified. These are two very different things. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index a52cbef48f..3c9df289b6 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -3500,6 +3500,7 @@ UefiDevicePathLibConvertTextToDevicePath (
DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
ASSERT (DeviceNode != NULL);
SetDevicePathEndNode (DeviceNode);
+ DeviceNode->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
FreePool (DevicePath);