linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get()
@ 2015-07-29 10:17 Dan Carpenter
  2015-07-29 14:09 ` Pawel Moll
  2015-07-29 18:25 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-07-29 10:17 UTC (permalink / raw)
  To: Michael Turquette, Pawel Moll
  Cc: Stephen Boyd, Linus Walleij, linux-clk, kernel-janitors

The ">" should be ">=" or we end up reading beyond the end of the array.

Fixes: 6e973d2c4385 ('clk: vexpress: Add separate SP810 driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index 64b0129..7fbe4d4 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -129,8 +129,8 @@ static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
 {
 	struct clk_sp810 *sp810 = data;
 
-	if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] >
-			ARRAY_SIZE(sp810->timerclken)))
+	if (WARN_ON(clkspec->args_count != 1 ||
+		    clkspec->args[0] >=	ARRAY_SIZE(sp810->timerclken)))
 		return NULL;
 
 	return sp810->timerclken[clkspec->args[0]].clk;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get()
  2015-07-29 10:17 [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get() Dan Carpenter
@ 2015-07-29 14:09 ` Pawel Moll
  2015-07-29 18:25 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Pawel Moll @ 2015-07-29 14:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Michael Turquette, Stephen Boyd, Linus Walleij,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org

On Wed, 2015-07-29 at 11:17 +0100, Dan Carpenter wrote:
> The ">" should be ">=" or we end up reading beyond the end of the array.
> 
> Fixes: 6e973d2c4385 ('clk: vexpress: Add separate SP810 driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
> index 64b0129..7fbe4d4 100644
> --- a/drivers/clk/versatile/clk-sp810.c
> +++ b/drivers/clk/versatile/clk-sp810.c
> @@ -129,8 +129,8 @@ static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
>  {
>  	struct clk_sp810 *sp810 = data;
>  
> -	if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] >
> -			ARRAY_SIZE(sp810->timerclken)))
> +	if (WARN_ON(clkspec->args_count != 1 ||
> +		    clkspec->args[0] >=	ARRAY_SIZE(sp810->timerclken)))
>  		return NULL;
>  
>  	return sp810->timerclken[clkspec->args[0]].clk;

Of course.

Acked-by: Pawel Moll <pawel.moll@arm.com>

Thanks!

Pawel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get()
  2015-07-29 10:17 [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get() Dan Carpenter
  2015-07-29 14:09 ` Pawel Moll
@ 2015-07-29 18:25 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2015-07-29 18:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Michael Turquette, Pawel Moll, Linus Walleij, linux-clk,
	kernel-janitors

On 07/29, Dan Carpenter wrote:
> The ">" should be ">=" or we end up reading beyond the end of the array.
> 
> Fixes: 6e973d2c4385 ('clk: vexpress: Add separate SP810 driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
> index 64b0129..7fbe4d4 100644
> --- a/drivers/clk/versatile/clk-sp810.c

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-29 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 10:17 [patch] clk: versatile: off by one in clk_sp810_timerclken_of_get() Dan Carpenter
2015-07-29 14:09 ` Pawel Moll
2015-07-29 18:25 ` Stephen Boyd

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