mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 15:14:18 +08:00
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: 3fde0e16d0
("drivers: clk: Add ZynqMP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
2e85c57493
commit
9a43be9ced
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user