All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
@ 2022-05-18  6:25 ` Hangyu Hua
  0 siblings, 0 replies; 6+ messages in thread
From: Hangyu Hua @ 2022-05-18  6:25 UTC (permalink / raw)
  To: ulf.hansson, mturquette, sboyd, linus.walleij
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Hangyu Hua

Off-by-one will happen when index == ARRAY_SIZE(ur->base).

Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/clk/ux500/reset-prcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/reset-prcc.c b/drivers/clk/ux500/reset-prcc.c
index fcd5d042806a..f7e48941fbc7 100644
--- a/drivers/clk/ux500/reset-prcc.c
+++ b/drivers/clk/ux500/reset-prcc.c
@@ -58,7 +58,7 @@ static void __iomem *u8500_prcc_reset_base(struct u8500_prcc_reset *ur,
 	prcc_num = id / PRCC_PERIPHS_PER_CLUSTER;
 	index = prcc_num_to_index(prcc_num);
 
-	if (index > ARRAY_SIZE(ur->base))
+	if (index >= ARRAY_SIZE(ur->base))
 		return NULL;
 
 	return ur->base[index];
-- 
2.25.1


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

* [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
@ 2022-05-18  6:25 ` Hangyu Hua
  0 siblings, 0 replies; 6+ messages in thread
From: Hangyu Hua @ 2022-05-18  6:25 UTC (permalink / raw)
  To: ulf.hansson, mturquette, sboyd, linus.walleij
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Hangyu Hua

Off-by-one will happen when index == ARRAY_SIZE(ur->base).

Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/clk/ux500/reset-prcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/reset-prcc.c b/drivers/clk/ux500/reset-prcc.c
index fcd5d042806a..f7e48941fbc7 100644
--- a/drivers/clk/ux500/reset-prcc.c
+++ b/drivers/clk/ux500/reset-prcc.c
@@ -58,7 +58,7 @@ static void __iomem *u8500_prcc_reset_base(struct u8500_prcc_reset *ur,
 	prcc_num = id / PRCC_PERIPHS_PER_CLUSTER;
 	index = prcc_num_to_index(prcc_num);
 
-	if (index > ARRAY_SIZE(ur->base))
+	if (index >= ARRAY_SIZE(ur->base))
 		return NULL;
 
 	return ur->base[index];
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
  2022-05-18  6:25 ` Hangyu Hua
@ 2022-05-18 13:39   ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-05-18 13:39 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: ulf.hansson, mturquette, sboyd, linux-clk, linux-arm-kernel,
	linux-kernel

On Wed, May 18, 2022 at 8:25 AM Hangyu Hua <hbh25y@gmail.com> wrote:

> Off-by-one will happen when index == ARRAY_SIZE(ur->base).
>
> Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>

Good catch!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
@ 2022-05-18 13:39   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-05-18 13:39 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: ulf.hansson, mturquette, sboyd, linux-clk, linux-arm-kernel,
	linux-kernel

On Wed, May 18, 2022 at 8:25 AM Hangyu Hua <hbh25y@gmail.com> wrote:

> Off-by-one will happen when index == ARRAY_SIZE(ur->base).
>
> Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>

Good catch!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
  2022-05-18  6:25 ` Hangyu Hua
@ 2022-05-18 20:34   ` Stephen Boyd
  -1 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2022-05-18 20:34 UTC (permalink / raw)
  To: Hangyu Hua, linus.walleij, mturquette, ulf.hansson
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Hangyu Hua

Quoting Hangyu Hua (2022-05-17 23:25:37)
> Off-by-one will happen when index == ARRAY_SIZE(ur->base).
> 
> Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---

Applied to clk-next

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

* Re: [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
@ 2022-05-18 20:34   ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2022-05-18 20:34 UTC (permalink / raw)
  To: Hangyu Hua, linus.walleij, mturquette, ulf.hansson
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Hangyu Hua

Quoting Hangyu Hua (2022-05-17 23:25:37)
> Off-by-one will happen when index == ARRAY_SIZE(ur->base).
> 
> Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---

Applied to clk-next

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-05-18 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  6:25 [PATCH] clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base() Hangyu Hua
2022-05-18  6:25 ` Hangyu Hua
2022-05-18 13:39 ` Linus Walleij
2022-05-18 13:39   ` Linus Walleij
2022-05-18 20:34 ` Stephen Boyd
2022-05-18 20:34   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.