Skip to contentSkip to conversation

drivers/pci/hotplug/ibmphp_pci.c: fix NULL dereference

PATCH New Adrian Bunk 1 participant 1 message Nov 17, 2006 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/pci/hotplug/ibmphp_pci.c: fix NULL dereference

The correct order is: NULL check before dereference

Spotted by the Coverity checker.

drivers/pci/hotplug/ibmphp_pci.c renamed from drivers/pci/hotplug/ibmphp_pci.c.old +2 -2
@@ -1371,12 +1371,12 @@ static int unconfigure_boot_bridge (u8 b
 	}
 
 	bus = ibmphp_find_res_bus (sec_number);
-	debug ("bus->busno is %x\n", bus->busno);
-	debug ("sec_number is %x\n", sec_number);
 	if (!bus) {
 		err ("cannot find Bus structure for the bridged device\n");
 		return -EINVAL;
 	}
+	debug("bus->busno is %x\n", bus->busno);
+	debug("sec_number is %x\n", sec_number);
 
 	ibmphp_remove_bus (bus, busno);