diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 509eb60e40..e6d20ab164 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -294,7 +294,13 @@ EfiShellGetMapFromDevicePath ( *DevicePath = NextDevicePathNode (*DevicePath); } - SetDevicePathEndNode (*DevicePath); + // + // Do not call SetDevicePathEndNode() if the device path node is already the + // end of an entire device path. + // + if (!IsDevicePathEnd (*DevicePath)) { + SetDevicePathEndNode (*DevicePath); + } } /*