From 8254f8feb71a93a4d87aa68d900660ef445d44cd Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 4 Sep 2019 12:52:01 +0200 Subject: efi_loader: correct text conversion for vendor DP Vendor device paths may contain data. When converting vendor device paths to text this binary data has to be rendered. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/efi_loader/efi_device_path_to_text.c') diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 96fd08971b7..133542ad408 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -60,9 +60,18 @@ static char *dp_hardware(char *s, struct efi_device_path *dp) break; } case DEVICE_PATH_SUB_TYPE_VENDOR: { + int i, n; struct efi_device_path_vendor *vdp = (struct efi_device_path_vendor *)dp; - s += sprintf(s, "VenHw(%pUl)", &vdp->guid); + + s += sprintf(s, "VenHw(%pUl", &vdp->guid); + n = (int)vdp->dp.length - sizeof(struct efi_device_path_vendor); + if (n > 0) { + s += sprintf(s, ","); + for (i = 0; i < n; ++i) + s += sprintf(s, "%02x", vdp->vendor_data[i]); + } + s += sprintf(s, ")"); break; } default: -- cgit v1.2.3 From 4411652aead3509ce497e4598f533e2b7e4f4ba0 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 4 Sep 2019 13:32:05 +0200 Subject: efi_loader: correctly render MAC address device path nodes If the interface type is greater 1 render all 32 bytes of the MAC address. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/efi_loader/efi_device_path_to_text.c') diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 133542ad408..892f5c4d33d 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -124,17 +124,16 @@ static char *dp_msging(char *s, struct efi_device_path *dp) break; } case DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR: { + int i, n = sizeof(struct efi_mac_addr); struct efi_device_path_mac_addr *mdp = (struct efi_device_path_mac_addr *)dp; - if (mdp->if_type != 0 && mdp->if_type != 1) - break; - - s += sprintf(s, "MAC(%02x%02x%02x%02x%02x%02x,0x%1x)", - mdp->mac.addr[0], mdp->mac.addr[1], - mdp->mac.addr[2], mdp->mac.addr[3], - mdp->mac.addr[4], mdp->mac.addr[5], - mdp->if_type); + if (mdp->if_type <= 1) + n = 6; + s += sprintf(s, "MAC("); + for (i = 0; i < n; ++i) + s += sprintf(s, "%02x", mdp->mac.addr[i]); + s += sprintf(s, ",%u)", mdp->if_type); break; } -- cgit v1.2.3 From d0384d516043f9c9c28158827a113771c3247536 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 4 Sep 2019 13:56:01 +0200 Subject: efi_loader: correctly render CD-ROM device path nodes Correct the name of the partition size component in struct efi_device_path_cdrom_path. Render entry, start, and size when converting a CD-ROM device path node to text. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/efi_loader/efi_device_path_to_text.c') diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 892f5c4d33d..6e27508fba4 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -214,7 +214,8 @@ static char *dp_media(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_CDROM_PATH: { struct efi_device_path_cdrom_path *cddp = (struct efi_device_path_cdrom_path *)dp; - s += sprintf(s, "CDROM(0x%x)", cddp->boot_entry); + s += sprintf(s, "CDROM(%u,0x%llx,0x%llx)", cddp->boot_entry, + cddp->partition_start, cddp->partition_size); break; } case DEVICE_PATH_SUB_TYPE_FILE_PATH: { -- cgit v1.2.3 From d41f99e17976e7a6c72fdba0025eb26d2c628494 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 4 Sep 2019 14:30:41 +0200 Subject: efi_loader: correctly render UsbClass DP nodes as text Correct the text representation of UsbClass device path nodes. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/efi_loader/efi_device_path_to_text.c') diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 6e27508fba4..b20b7c097c9 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -141,7 +141,7 @@ static char *dp_msging(char *s, struct efi_device_path *dp) struct efi_device_path_usb_class *ucdp = (struct efi_device_path_usb_class *)dp; - s += sprintf(s, "USBClass(%x,%x,%x,%x,%x)", + s += sprintf(s, "UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)", ucdp->vendor_id, ucdp->product_id, ucdp->device_class, ucdp->device_subclass, ucdp->device_protocol); -- cgit v1.2.3