Skip to contentSkip to conversation

SDRC: prevent null pointer dereference if sdrc_init_params is null

PATCH New Paul Walmsley 2 participants 2 messages Mar 24, 2009 – Mar 25, 2009

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

PATCH 1/1 SDRC: prevent null pointer dereference if sdrc_init_params is null

omap2_sdrc_get_params() should check to see if a board-*.c file has called omap2_init_common_hw() with a null pointer for the omap_sdrc_params argument, rather than attempting to dereference it. Otherwise, boot will fail after the "Reprogramming SDRC" boot message. Problem found by Peter Barada <[email protected]>.

---
 arch/arm/mach-omap2/sdrc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/sdrc.c +3 -0
index 7da6587..993fd25 100644
@@ -56,6 +56,9 @@ struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
 {
 	struct omap_sdrc_params *sp;
 
+	if (!sdrc_init_params)
+		return NULL;
+
 	sp = sdrc_init_params;
 
 	while (sp->rate && sp->rate != r)