hdt: Pxe mode might generate corruption
authorErwan Velu <erwan.velu@free.fr>
Wed, 25 Mar 2009 11:59:00 +0000 (12:59 +0100)
committerErwan Velu <erwan.velu@free.fr>
Wed, 25 Mar 2009 11:59:00 +0000 (12:59 +0100)
Impact: Prevent some hard lock due to pxe detection

In some cases, we can't find the associated PCI device.
In such situation, we shouldn't try to display its properties as
pci_device is set to NULL.

com32/hdt/hdt-cli-pxe.c
com32/hdt/hdt-menu-pxe.c

index 772c0df..5c55664 100644 (file)
@@ -55,7 +55,7 @@ void main_show_pxe(struct s_hardware *hardware)
   struct s_pxe *p = &hardware->pxe;
   more_printf(" PCI device no: %d \n", p->pci_device_pos);
 
-  if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+  if ((hardware->pci_ids_return_code == -ENOPCIIDS) ||  (p->pci_device==NULL)) {
     snprintf(buffer, sizeof(buffer),
        " PCI ID       : %04x:%04x[%04x:%04X] rev(%02x)\n",
        p->vendor_id, p->product_id, p->subvendor_id,
index 686117a..497fa77 100644 (file)
@@ -43,7 +43,7 @@ void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware)
 
   struct s_pxe *p = &hardware->pxe;
 
-  if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+  if ((hardware->pci_ids_return_code == -ENOPCIIDS) || (p->pci_device==NULL))  {
     snprintf(buffer, sizeof buffer, "PCI Vendor    : %d",
        p->vendor_id);
     snprintf(infobar, sizeof infobar, "PCI Vendor    : %d",