From patchwork Tue Mar 24 00:41:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 13863 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2O0fuZ3016944 for ; Tue, 24 Mar 2009 00:41:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbZCXAl4 (ORCPT ); Mon, 23 Mar 2009 20:41:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752603AbZCXAl4 (ORCPT ); Mon, 23 Mar 2009 20:41:56 -0400 Received: from utopia.booyaka.com ([72.9.107.138]:50727 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbZCXAl4 (ORCPT ); Mon, 23 Mar 2009 20:41:56 -0400 Received: (qmail 12174 invoked by uid 526); 24 Mar 2009 00:41:53 -0000 Date: Mon, 23 Mar 2009 18:41:53 -0600 (MDT) From: Paul Walmsley To: linux-omap@vger.kernel.org cc: Peter Barada Subject: [PATCH] SDRC: prevent null pointer dereference if sdrc_init_params is null Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 --- arch/arm/mach-omap2/sdrc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index 7da6587..993fd25 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)