mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] SPARC64: check for possible NULL pointer dereference
@ 2007-11-20 17:28 Cyrill Gorcunov
  2007-11-21  1:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2007-11-20 17:28 UTC (permalink / raw)
  To: David Miller; +Cc: LKML, sparclinux

From: Cyrill Gorcunov <gorcunov@gmail.com>

This patch adds checking for possible NULL pointer dereference
if of_find_property() failed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
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(-)

diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 8c4875b..e587a37 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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] SPARC64: check for possible NULL pointer dereference
  2007-11-20 17:28 [PATCH] SPARC64: check for possible NULL pointer dereference Cyrill Gorcunov
@ 2007-11-21  1:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-11-21  1:32 UTC (permalink / raw)
  To: gorcunov; +Cc: linux-kernel, sparclinux

From: Cyrill Gorcunov <gorcunov@gmail.com>
Date: Tue, 20 Nov 2007 20:28:33 +0300

> From: Cyrill Gorcunov <gorcunov@gmail.com>
> 
> This patch adds checking for possible NULL pointer dereference
> if of_find_property() failed.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-21  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-20 17:28 [PATCH] SPARC64: check for possible NULL pointer dereference Cyrill Gorcunov
2007-11-21  1:32 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®