* [PATCH] OMAP: timer-gp: Fix for null pointer dereferencing issue
@ 2009-07-09 11:39 Mittal, Mukund
2009-07-09 15:04 ` Kevin Hilman
0 siblings, 1 reply; 2+ messages in thread
From: Mittal, Mukund @ 2009-07-09 11:39 UTC (permalink / raw)
To: linux-omap@vger.kernel.org
From: Mukund Mittal <mmittal@ti.com>
OMAP: timer-gp: Fix for null pointer dereferencing issue
There was a null pointer dereferencing issue for gpt pointer.
It was checked and an error was printed but execution was not terminated.
Fixed by calling function BUG().
Signed-off-by: Mukund Mittal <mmittal@ti.com>
---
arch/arm/mach-omap2/timer-gp.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
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
@@ -205,14 +205,13 @@ static void __init omap2_gp_clocksource_
{
static struct omap_dm_timer *gpt;
u32 tick_rate, tick_period;
- static char err1[] __initdata = KERN_ERR
- "%s: failed to request dm-timer\n";
- static char err2[] __initdata = KERN_ERR
- "%s: can't register clocksource!\n";
gpt = omap_dm_timer_request();
- if (!gpt)
- printk(err1, clocksource_gpt.name);
+ if (!gpt) {
+ printk(KERN_ERR "%s: failed to request dm-timer\n",
+ clocksource_gpt.name);
+ BUG();
+ }
gpt_clocksource = gpt;
omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
@@ -224,7 +223,8 @@ static void __init omap2_gp_clocksource_
clocksource_gpt.mult =
clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
if (clocksource_register(&clocksource_gpt))
- printk(err2, clocksource_gpt.name);
+ printk(KERN_ERR "%s: can't register clocksource!\n",
+ clocksource_gpt.name);
}
#endif
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] OMAP: timer-gp: Fix for null pointer dereferencing issue
2009-07-09 11:39 [PATCH] OMAP: timer-gp: Fix for null pointer dereferencing issue Mittal, Mukund
@ 2009-07-09 15:04 ` Kevin Hilman
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2009-07-09 15:04 UTC (permalink / raw)
To: Mittal, Mukund; +Cc: linux-omap@vger.kernel.org
"Mittal, Mukund" <mmittal@ti.com> writes:
> From: Mukund Mittal <mmittal@ti.com>
>
> OMAP: timer-gp: Fix for null pointer dereferencing issue
>
> There was a null pointer dereferencing issue for gpt pointer.
> It was checked and an error was printed but execution was not terminated.
> Fixed by calling function BUG().
I think BUG() is a bit drastic here. I think it should probably
WARN() and fail gracefully instead of grind to a screeching halt.
Kevin
> Signed-off-by: Mukund Mittal <mmittal@ti.com>
> ---
> arch/arm/mach-omap2/timer-gp.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> 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
> @@ -205,14 +205,13 @@ static void __init omap2_gp_clocksource_
> {
> static struct omap_dm_timer *gpt;
> u32 tick_rate, tick_period;
> - static char err1[] __initdata = KERN_ERR
> - "%s: failed to request dm-timer\n";
> - static char err2[] __initdata = KERN_ERR
> - "%s: can't register clocksource!\n";
>
> gpt = omap_dm_timer_request();
> - if (!gpt)
> - printk(err1, clocksource_gpt.name);
> + if (!gpt) {
> + printk(KERN_ERR "%s: failed to request dm-timer\n",
> + clocksource_gpt.name);
> + BUG();
> + }
> gpt_clocksource = gpt;
>
> omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
> @@ -224,7 +223,8 @@ static void __init omap2_gp_clocksource_
> clocksource_gpt.mult =
> clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
> if (clocksource_register(&clocksource_gpt))
> - printk(err2, clocksource_gpt.name);
> + printk(KERN_ERR "%s: can't register clocksource!\n",
> + clocksource_gpt.name);
> }
> #endif
>
> --
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-09 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 11:39 [PATCH] OMAP: timer-gp: Fix for null pointer dereferencing issue Mittal, Mukund
2009-07-09 15:04 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox