Skip to contentSkip to conversation

- fix pci/probe.c possible NULL pointer.

PATCH New Luiz Fernando N. Capitulino 1 participant 1 message May 27, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - fix pci/probe.c possible NULL pointer.

Hi,

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 <[email protected]>

 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+)
drivers/pci/probe.c +2 -0
diff -X dontdiff -Nparu a/drivers/pci/probe.c a~/drivers/pci/probe.c
@@ -366,6 +366,8 @@ int __devinit pci_scan_bridge(struct pci
 			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;
Signature · 2 lines
Luiz Fernando N. Capitulino
<http://www.telecentros.sp.gov.br>

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors