summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-12-03 15:52:01 +0100
committerStephen Boyd <sboyd@kernel.org>2018-12-03 18:54:48 +0100
commit9a43be9cedd516f188e6333d3b43402386723eff (patch)
treec0d18204a8241806ba758414beb67e6f840e7d4a /drivers
parentclk: mmp: Off by one in mmp_clk_add() (diff)
downloadlinux-9a43be9cedd516f188e6333d3b43402386723eff.tar.xz
linux-9a43be9cedd516f188e6333d3b43402386723eff.zip
clk: zynqmp: Off by one in zynqmp_is_valid_clock()
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> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/zynqmp/clkc.c2
1 files changed, 1 insertions, 1 deletions
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;