[coreboot] r631 - coreboot-v3/device
svn at coreboot.org
svn at coreboot.org
Wed Mar 5 13:57:11 CET 2008
Author: hailfinger
Date: 2008-03-05 13:57:10 +0100 (Wed, 05 Mar 2008)
New Revision: 631
Modified:
coreboot-v3/device/device.c
coreboot-v3/device/pci_device.c
Log:
Fix two NULL pointer dereferences in device code.
Add a nasty warning if one of the cases triggers because that should
not happen. We should fix the cases where the warning triggers.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Ronald G. Minnich <rminnich at gmail.com>
Modified: coreboot-v3/device/device.c
===================================================================
--- coreboot-v3/device/device.c 2008-03-03 16:14:15 UTC (rev 630)
+++ coreboot-v3/device/device.c 2008-03-05 12:57:10 UTC (rev 631)
@@ -278,8 +278,13 @@
struct device *curdev;
printk(BIOS_SPEW, "%s: %s(%s) read_resources bus %d link: %d\n",
- __func__, bus->dev->dtsname, dev_path(bus->dev),
+ __func__,
+ (bus->dev ? bus->dev->dtsname : "No dtsname for NULL device"),
+ (bus->dev ? dev_path(bus->dev) : "No path for NULL device"),
bus->secondary, bus->link);
+ if (!bus->dev)
+ printk(BIOS_WARNING, "%s: ERROR: bus->dev is NULL!\n",
+ __func__);
/* Walk through all devices and find which resources they need. */
for (curdev = bus->children; curdev; curdev = curdev->sibling) {
Modified: coreboot-v3/device/pci_device.c
===================================================================
--- coreboot-v3/device/pci_device.c 2008-03-03 16:14:15 UTC (rev 630)
+++ coreboot-v3/device/pci_device.c 2008-03-05 12:57:10 UTC (rev 631)
@@ -1101,7 +1101,7 @@
dev = pci_probe_dev(dev, bus, devfn);
printk(BIOS_SPEW,
"PCI: pci_scan_bus pci_probe_dev returns dev %p(%s)\n",
- dev, dev->dtsname);
+ dev, dev ? dev->dtsname : "None (not found)");
/* If this is not a multi function device, or the device is
* not present don't waste time probing another function.
More information about the coreboot
mailing list