]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] PCI: fix pci/probe.c possible NULL pointer.
authorLuiz Capitulino <lcapitulino@prefeitura.sp.gov.br>
Fri, 28 May 2004 06:37:08 +0000 (23:37 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 28 May 2004 06:37:08 +0000 (23:37 -0700)
 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@prefeitura.sp.gov.br>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/pci/probe.c

index c301be5c9cfc3112ea1501f4bdab4c690023eb28..736a56f7f98bbbba78d7b2ecba3f7817029fb8a8 100644 (file)
@@ -366,6 +366,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
                        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;