From: Cyrill Gorcunov Date: Wed, 21 Nov 2007 01:32:19 +0000 (-0800) Subject: [SPARC64]: check for possible NULL pointer dereference X-Git-Tag: v2.6.24-rc5~65^2~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75c6d1410caa6fea861ef3802e8b186f7685f235;p=linux-2.6 [SPARC64]: check for possible NULL pointer dereference This patch adds checking for possible NULL pointer dereference if of_find_property() failed. Signed-off-by: Cyrill Gorcunov Signed-off-by: David S. Miller --- diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 8c4875bdb4..e587a372f3 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c @@ -1022,6 +1022,10 @@ void __init sun4v_pci_init(struct device_node *dp, char *model_name) } prop = of_find_property(dp, "reg", NULL); + if (!prop) { + prom_printf("SUN4V_PCI: Could not find config registers\n"); + prom_halt(); + } regs = prop->value; devhandle = (regs->phys_addr >> 32UL) & 0x0fffffff;