SPARC64: check for possible NULL pointer dereference
PATCH 1/1 SPARC64: check for possible NULL pointer dereference
From: Cyrill Gorcunov <[email protected]>
This patch adds checking for possible NULL pointer dereference if of_find_property() failed.
Signed-off-by Cyrill Gorcunov <[email protected]>
---
I'm not sure about the message being printed in worst case. Check please.
arch/sparc64/kernel/pci_sun4v.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/sparc64/kernel/pci_sun4v.c +4 -0
@@ -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 ;
David Miller
AppliedFrom: Cyrill Gorcunov <[email protected]>
Date: Tue, 20 Nov 2007 20:28:33 +0300
Quoted 6 lines
From: Cyrill Gorcunov <[email protected]>
This patch adds checking for possible NULL pointer dereference if
of_find_property()failed.Signed-off-by Cyrill Gorcunov <[email protected]>
Applied, thanks.