Re: [PATCH] PCI fixes for 2.6.7-rc1

From: Greg KH
Date: Fri May 28 2004 - 17:42:43 EST


ChangeSet 1.1759, 2004/05/28 13:37:08-07:00, lcapitulino@xxxxxxxxxxxxxxxxxxxx

[PATCH] PCI: fix pci/probe.c possible NULL pointer.

In drivers/pci/probe.c::pci_scan_bridge() the call for pci_alloc_child_bus()
can return NULL, but it is not handled by the function (detected by
Coverity's checker).

The patch bellow fix that returning `max' if we got the NULL, but
I do not know if it is right. I guess it is, because in that case
the function will act in the same way as with `pass != 0'.

Signed-off by: Luiz Capitulino <lcapitulino@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/pci/probe.c | 2 ++
1 files changed, 2 insertions(+)


diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c Fri May 28 14:28:53 2004
+++ b/drivers/pci/probe.c Fri May 28 14:28:53 2004
@@ -366,6 +366,8 @@
return max;
busnr = (buses >> 8) & 0xFF;
child = pci_alloc_child_bus(bus, dev, busnr);
+ if (!child)
+ return max;
child->primary = buses & 0xFF;
child->subordinate = (buses >> 16) & 0xFF;
child->bridge_ctl = bctl;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/