fix device path length

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2019-12-11 16:13:31 +03:00
parent 90148880ac
commit 3b4ce81052

View File

@ -67,13 +67,15 @@ CHAR8 *get_pci_dev_path(pci_dt_t *PciDt)
CHAR8* tmp;
CHAR16* devpathstr = NULL;
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
UINTN Size;
DevicePath = DevicePathFromHandle (PciDt->DeviceHandle);
if (!DevicePath)
return NULL;
devpathstr = FileDevicePathToStr(DevicePath);
tmp = AllocateZeroPool((StrLen(devpathstr)+1)*sizeof(CHAR16));
UnicodeStrToAsciiStrS(devpathstr, tmp, (StrLen(devpathstr)+1));
Size = StrLen(devpathstr) + 1;
tmp = AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(devpathstr, tmp, Size);
return tmp;
}