Skip to content

Commit 2e85c57

Browse files
Dan Carpenterbebarino
authored andcommitted
clk: mmp: Off by one in mmp_clk_add()
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: 4661fda ("clk: mmp: add basic support functions for DT support") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent d9f5b7f commit 2e85c57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/mmp/clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
183183
pr_err("CLK %d has invalid pointer %p\n", id, clk);
184184
return;
185185
}
186-
if (id > unit->nr_clks) {
186+
if (id >= unit->nr_clks) {
187187
pr_err("CLK %d is invalid\n", id);
188188
return;
189189
}

0 commit comments

Comments
 (0)