* [PATCH] ARM: OMAP2: possible division by 0
@ 2009-03-17 11:43 Roel Kluin
2009-03-18 22:01 ` [APPLIED] " Tony Lindgren
2009-03-18 22:03 ` Tony Lindgren
0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-03-17 11:43 UTC (permalink / raw)
To: rmk+kernel; +Cc: linux-omap, Linux-arm
In linus' git tree the functions can be found at:
vi arch/arm/mach-omap2/usb-tusb6010.c +200 - tusb6010_platform_retime()
vi arch/arm/mach-omap2/gpmc.c +94 - gpmc_get_fclk_period()
vi arch/arm/mach-omap2/usb-tusb6010.c +53 - tusb_set_async_mode()
vi arch/arm/mach-omap2/usb-tusb6010.c +111 - tusb_set_sync_mode()
is -ENODEV appropriate when sysclk_ps == 0?
This was found by code analysis, please review.
------------------------------>8-------------8<---------------------------------
gpmc_get_fclk_period() may return 0 when gpmc_l3_clk is not enabled. This is
not checked in tusb6010_platform_retime() nor in tusb_set_async_mode() it
seems. In tusb_set_sync_mode() this may result in a division by zero.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 15e5090..8df55f4 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk)
unsigned sysclk_ps;
int status;
- if (!refclk_psec)
+ if (!refclk_psec || sysclk_ps == 0)
return -ENODEV;
sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [APPLIED] [PATCH] ARM: OMAP2: possible division by 0
2009-03-17 11:43 [PATCH] ARM: OMAP2: possible division by 0 Roel Kluin
@ 2009-03-18 22:01 ` Tony Lindgren
2009-03-18 22:03 ` Tony Lindgren
1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-03-18 22:01 UTC (permalink / raw)
To: linux-omap
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Commit: a170fc43065439cff6d18f02a1571a92718b9623
PatchWorks
http://patchwork.kernel.org/patch/12591/
Git
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=a170fc43065439cff6d18f02a1571a92718b9623
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: OMAP2: possible division by 0
2009-03-17 11:43 [PATCH] ARM: OMAP2: possible division by 0 Roel Kluin
2009-03-18 22:01 ` [APPLIED] " Tony Lindgren
@ 2009-03-18 22:03 ` Tony Lindgren
1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-03-18 22:03 UTC (permalink / raw)
To: Roel Kluin; +Cc: rmk+kernel, linux-omap, Linux-arm
* Roel Kluin <roel.kluin@gmail.com> [090317 04:50]:
> In linus' git tree the functions can be found at:
> vi arch/arm/mach-omap2/usb-tusb6010.c +200 - tusb6010_platform_retime()
> vi arch/arm/mach-omap2/gpmc.c +94 - gpmc_get_fclk_period()
> vi arch/arm/mach-omap2/usb-tusb6010.c +53 - tusb_set_async_mode()
> vi arch/arm/mach-omap2/usb-tusb6010.c +111 - tusb_set_sync_mode()
>
> is -ENODEV appropriate when sysclk_ps == 0?
>
> This was found by code analysis, please review.
> ------------------------------>8-------------8<---------------------------------
> gpmc_get_fclk_period() may return 0 when gpmc_l3_clk is not enabled. This is
> not checked in tusb6010_platform_retime() nor in tusb_set_async_mode() it
> seems. In tusb_set_sync_mode() this may result in a division by zero.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Looks like a valid fix to me. I'll add it to omap-fixes queue.
To me it sounds like there's no urgent need to get this integrated
as we're missing most of the omap2 PM still.
Tony
> ---
> diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
> index 15e5090..8df55f4 100644
> --- a/arch/arm/mach-omap2/usb-tusb6010.c
> +++ b/arch/arm/mach-omap2/usb-tusb6010.c
> @@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk)
> unsigned sysclk_ps;
> int status;
>
> - if (!refclk_psec)
> + if (!refclk_psec || sysclk_ps == 0)
> return -ENODEV;
>
> sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
> --
> 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] 3+ messages in thread
end of thread, other threads:[~2009-03-18 22:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-17 11:43 [PATCH] ARM: OMAP2: possible division by 0 Roel Kluin
2009-03-18 22:01 ` [APPLIED] " Tony Lindgren
2009-03-18 22:03 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).