diff mbox

[01/13] ARM: OMAP2+: clock/dpll: fix _dpll_test_fint arithmetics overflow

Message ID 1404290867-6768-2-git-send-email-t-kristo@ti.com
State Accepted
Commit 6340c8720ce34f35b41a2e15d69fe3d755cb2104
Headers show

Commit Message

Tero Kristo July 2, 2014, 8:47 a.m. UTC
The divider value provided to the _dpll_test_fint can reach value of
256 with J type DPLLs (USB etc.), which causes an overflow with the u8
datatype. Fix this by changing the parameter to be an int instead.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/clkt_dpll.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Walmsley July 6, 2014, 9:58 p.m. UTC | #1
On Wed, 2 Jul 2014, Tero Kristo wrote:

> The divider value provided to the _dpll_test_fint can reach value of
> 256 with J type DPLLs (USB etc.), which causes an overflow with the u8
> datatype. Fix this by changing the parameter to be an int instead.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  arch/arm/mach-omap2/clkt_dpll.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
> index 332af92..5aa734a 100644
> --- a/arch/arm/mach-omap2/clkt_dpll.c
> +++ b/arch/arm/mach-omap2/clkt_dpll.c
> @@ -76,7 +76,7 @@
>   * (assuming that it is counting N upwards), or -2 if the enclosing loop
>   * should skip to the next iteration (again assuming N is increasing).
>   */
> -static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
> +static int _dpll_test_fint(struct clk_hw_omap *clk, int n)
>  {
>  	struct dpll_data *dd;
>  	long fint, fint_min, fint_max;
> -- 
> 1.7.9.5
> 

Queued for v3.16-rc fixes, but I've changed the type of 'n' to be unsigned 
int rather than int, since a negative n is meaningless.


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

diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 332af92..5aa734a 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -76,7 +76,7 @@ 
  * (assuming that it is counting N upwards), or -2 if the enclosing loop
  * should skip to the next iteration (again assuming N is increasing).
  */
-static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
+static int _dpll_test_fint(struct clk_hw_omap *clk, int n)
 {
 	struct dpll_data *dd;
 	long fint, fint_min, fint_max;