From: Paul Walmsley Date: Tue, 24 Mar 2009 00:41:53 +0000 (+0000) Subject: SDRC: prevent null pointer dereference if sdrc_init_params is null X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?p=linux-2.6-omap-h63xx.git;a=commitdiff_plain;h=c4df5a4d436bc3aea65cc665025d5ce62c8dfe09 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 . Signed-off-by: Paul Walmsley Tested-by: Peter Barada Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index 7da65879bcc..993fd253cb9 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c @@ -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)