Browse Source

[pxe] Avoid touching fields that may not exist in PXENV_UNDI_GET_NIC_TYPE

Earlier versions of the PXE specification do not have the SubVendor_ID
and SubDevice_ID fields, and some NBPs may not provide space for them.
Avoid overwriting the contents of these fields, just in case.

This is similar to the problem with the BufferLimit field in
PXENV_GET_CACHED_INFO.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
0620429785
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/arch/i386/interface/pxe/pxe_undi.c

+ 5
- 5
src/arch/i386/interface/pxe/pxe_undi.c View File

@@ -561,12 +561,12 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
561 561
 		info->Sub_Class = PCI_SUB_CLASS ( dev->desc.class );
562 562
 		info->Prog_Intf = PCI_PROG_INTF ( dev->desc.class );
563 563
 		info->BusDevFunc = dev->desc.location;
564
-		/* Cheat: remaining fields are probably unnecessary,
565
-		 * and would require adding extra code to pci.c.
564
+		/* Earlier versions of the PXE specification do not
565
+		 * have the SubVendor_ID and SubDevice_ID fields.  It
566
+		 * is possible that some NBPs will not provide space
567
+		 * for them, and so we must not fill them in.
566 568
 		 */
567
-		undi_get_nic_type->info.pci.SubVendor_ID = 0xffff;
568
-		undi_get_nic_type->info.pci.SubDevice_ID = 0xffff;
569
-		DBG ( " PCI %02x:%02x.%x %04x:%04x (%04x:%04x) %02x%02x%02x "
569
+		DBG ( " PCI %02x:%02x.%x %04x:%04x ('%04x:%04x') %02x%02x%02x "
570 570
 		      "rev %02x\n", PCI_BUS ( info->BusDevFunc ),
571 571
 		      PCI_SLOT ( info->BusDevFunc ),
572 572
 		      PCI_FUNC ( info->BusDevFunc ), info->Vendor_ID,

Loading…
Cancel
Save