Skip to content

Commit 9a43be9

Browse files
Dan Carpenterbebarino
authored andcommitted
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: 3fde0e1 ("drivers: clk: Add ZynqMP clock driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 2e85c57 commit 9a43be9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/zynqmp/clkc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static const struct zynqmp_eemi_ops *eemi_ops;
128128
*/
129129
static inline int zynqmp_is_valid_clock(u32 clk_id)
130130
{
131-
if (clk_id > clock_max_idx)
131+
if (clk_id >= clock_max_idx)
132132
return -ENODEV;
133133

134134
return clock[clk_id].valid;

0 commit comments

Comments
 (0)