diff mbox

[v3] OMAP: timer-gp: Fix for null pointer dereferencing issue

Message ID EAF47CD23C76F840A9E7FCE10091EFAB02B57BB71E@dbde02.ent.ti.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Mittal, Mukund July 16, 2009, 12:21 p.m. UTC
From: Mukund Mittal <mmittal@ti.com>

OMAP: timer-gp: Fix for null pointer dereferencing issue

Calling WARN_ON() to warn for null pointer dereferencing for gpt pointer. 

Signed-off-by: Mukund Mittal <mmittal@ti.com>
---
 arch/arm/mach-omap2/timer-gp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)




--
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

Comments

Kevin Hilman July 16, 2009, 9:10 p.m. UTC | #1
"Mittal, Mukund" <mmittal@ti.com> writes:

> From: Mukund Mittal <mmittal@ti.com>
>
> OMAP: timer-gp: Fix for null pointer dereferencing issue

not exaclty a "fix".  this patch will print a warning and
happily continue on and dereference the NULL.

> Calling WARN_ON() to warn for null pointer dereferencing for gpt pointer. 
>
> Signed-off-by: Mukund Mittal <mmittal@ti.com>
> ---
>  arch/arm/mach-omap2/timer-gp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/timer-gp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/timer-gp.c
> +++ linux-omap-2.6/arch/arm/mach-omap2/timer-gp.c
> @@ -211,8 +211,10 @@ static void __init omap2_gp_clocksource_
>  		"%s: can't register clocksource!\n";
>  
>  	gpt = omap_dm_timer_request();
> -	if (!gpt)
> +	if (!gpt) {
>  		printk(err1, clocksource_gpt.name);
> +		WARN_ON(1);
> +	}

What you want is something like this (untested):

     if (WARN_ON(!gpt1, err1, clocksource_gpt.name))
        return;

>  	gpt_clocksource = gpt;
>  
>  	omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
--
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 mbox

Patch

Index: linux-omap-2.6/arch/arm/mach-omap2/timer-gp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/timer-gp.c
+++ linux-omap-2.6/arch/arm/mach-omap2/timer-gp.c
@@ -211,8 +211,10 @@  static void __init omap2_gp_clocksource_
 		"%s: can't register clocksource!\n";
 
 	gpt = omap_dm_timer_request();
-	if (!gpt)
+	if (!gpt) {
 		printk(err1, clocksource_gpt.name);
+		WARN_ON(1);
+	}
 	gpt_clocksource = gpt;
 
 	omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);