git: b782b7884c8a - main - libefivar: Fix FromText bug for multi-instance devicepath

From: Warner Losh <>
Date: Sun, 27 Feb 2022 16:47:35 UTC
The branch main has been updated by imp:


commit b782b7884c8aa19cb2dcb6ece6909e9f05173d72
Author:     Jose Luis Duran <>
AuthorDate: 2022-02-25 14:39:12 +0000
Commit:     Warner Losh <>
CommitDate: 2022-02-27 16:11:59 +0000

    libefivar: 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:
    if (IsInstanceEnd) {
      DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (
      ASSERT (DeviceNode != NULL);
      SetDevicePathEndNode (DeviceNode);
      NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
      FreePool (DevicePath);
      FreePool (DeviceNode);
      DevicePath = NewDevicePath;
    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.
    This fix was already committed.  It has been included with the sole
    intention of reducing diffs with upstream.
    Upstream Bug:
    Obtained from:
    Pull Request:
 lib/libefivar/efivar-dp-parse.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c
index 4040b001708d..82f9c6027d32 100644
--- a/lib/libefivar/efivar-dp-parse.c
+++ b/lib/libefivar/efivar-dp-parse.c
@@ -3680,7 +3680,6 @@ UefiDevicePathLibConvertTextToDevicePath (
       ASSERT (DeviceNode != NULL);
       SetDevicePathEndNode (DeviceNode);
-      // Fix from
       NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);