summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-12-03 17:51:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-21 14:11:37 +0100
commit4ff9a2f211eade1f706a522285646ec5cfdd217e (patch)
tree057e209a3978a6bc4fb6580e0359a80c48ba5009 /drivers/clk
parent38391d6b11449ee86e3f6af003e4218ab95d3bec (diff)
clk: mmp: Off by one in mmp_clk_add()
[ Upstream commit 2e85c57493e391b93445c1e0d530b36b95becc64 ] The > comparison should be >= or we write one element beyond the end of the unit->clk_table[] array. (The unit->clk_table[] array is allocated in the mmp_clk_init() function and it has unit->nr_clks elements). Fixes: 4661fda10f8b ("clk: mmp: add basic support functions for DT support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/mmp/clk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c
index 61893fe73251..18b6c9b55b95 100644
--- a/drivers/clk/mmp/clk.c
+++ b/drivers/clk/mmp/clk.c
@@ -182,7 +182,7 @@ void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
pr_err("CLK %d has invalid pointer %p\n", id, clk);
return;
}
- if (id > unit->nr_clks) {
+ if (id >= unit->nr_clks) {
pr_err("CLK %d is invalid\n", id);
return;
}