Commit 440bc234 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

clk: versatile: off by one in clk_sp810_timerclken_of_get()

commit 3294bee8 upstream.

The ">" should be ">=" or we end up reading beyond the end of the array.

Fixes: 6e973d2c ('clk: vexpress: Add separate SP810 driver')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarPawel Moll <pawel.moll@arm.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72abd053
......@@ -128,8 +128,8 @@ static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
{
struct clk_sp810 *sp810 = data;
if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] >
ARRAY_SIZE(sp810->timerclken)))
if (WARN_ON(clkspec->args_count != 1 ||
clkspec->args[0] >= ARRAY_SIZE(sp810->timerclken)))
return NULL;
return sp810->timerclken[clkspec->args[0]].clk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment