All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
@ 2018-12-03 14:52 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-12-03 14:52 UTC (permalink / raw)
  To: Michael Turquette, Jolly Shah
  Cc: Stephen Boyd, Michal Simek, Rajan Vaja, Tejas Patel, linux-clk,
	kernel-janitors

The > comparison should be >= to prevent reading beyond the end of the
clock[] array.

(The clock[] array is allocated in zynqmp_clk_setup() and has
clock_max_idx elements.)

Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 297f16a20bfc..f65cc0ff76ab 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -128,7 +128,7 @@ static const struct zynqmp_eemi_ops *eemi_ops;
  */
 static inline int zynqmp_is_valid_clock(u32 clk_id)
 {
-	if (clk_id > clock_max_idx)
+	if (clk_id >= clock_max_idx)
 		return -ENODEV;
 
 	return clock[clk_id].valid;
-- 
2.11.0

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

* [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
@ 2018-12-03 14:52 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-12-03 14:52 UTC (permalink / raw)
  To: Michael Turquette, Jolly Shah
  Cc: Stephen Boyd, Michal Simek, Rajan Vaja, Tejas Patel, linux-clk,
	kernel-janitors

The > comparison should be >= to prevent reading beyond the end of the
clock[] array.

(The clock[] array is allocated in zynqmp_clk_setup() and has
clock_max_idx elements.)

Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 297f16a20bfc..f65cc0ff76ab 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -128,7 +128,7 @@ static const struct zynqmp_eemi_ops *eemi_ops;
  */
 static inline int zynqmp_is_valid_clock(u32 clk_id)
 {
-	if (clk_id > clock_max_idx)
+	if (clk_id >= clock_max_idx)
 		return -ENODEV;
 
 	return clock[clk_id].valid;
-- 
2.11.0


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

* Re: [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
  2018-12-03 14:52 ` Dan Carpenter
@ 2018-12-03 17:55   ` Stephen Boyd
  -1 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2018-12-03 17:55 UTC (permalink / raw)
  To: Dan Carpenter, Jolly Shah, Michael Turquette
  Cc: Michal Simek, Rajan Vaja, Tejas Patel, linux-clk, kernel-janitors

Quoting Dan Carpenter (2018-12-03 06:52:01)
> The > comparison should be >= to prevent reading beyond the end of the
> clock[] array.
> 
> (The clock[] array is allocated in zynqmp_clk_setup() and has
> clock_max_idx elements.)
> 
> Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Applied to clk-fixes

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

* Re: [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
@ 2018-12-03 17:55   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2018-12-03 17:55 UTC (permalink / raw)
  To: Dan Carpenter, Jolly Shah, Michael Turquette
  Cc: Michal Simek, Rajan Vaja, Tejas Patel, linux-clk, kernel-janitors

Quoting Dan Carpenter (2018-12-03 06:52:01)
> The > comparison should be >= to prevent reading beyond the end of the
> clock[] array.
> 
> (The clock[] array is allocated in zynqmp_clk_setup() and has
> clock_max_idx elements.)
> 
> Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Applied to clk-fixes


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

end of thread, other threads:[~2018-12-03 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 14:52 [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock() Dan Carpenter
2018-12-03 14:52 ` Dan Carpenter
2018-12-03 17:55 ` Stephen Boyd
2018-12-03 17:55   ` 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.