diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-10-19 20:49:39 +0900 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-10-19 13:14:18 -0700 |
commit | 7d36b9c102318aa86aceb074359305da88ce9ef9 (patch) | |
tree | 253f26b37d4c3866f9bfe643d1e391f2fd751376 /drivers/clk/uniphier | |
parent | d3397484bb5b8534289a630c1a78500ff4f2fbf4 (diff) |
clk: uniphier: fix memory overrun bug
The first loop of this "for" statement writes memory beyond the
allocated clk_hw_onecell_data.
It should be:
for (clk_num--; clk_num >= 0; clk_num--)
...
Or more simply:
while (--clk_num >= 0)
...
Fixes: 734d82f4a678 ("clk: uniphier: add core support code for UniPhier clock driver")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/uniphier')
-rw-r--r-- | drivers/clk/uniphier/clk-uniphier-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c index f4e0f6be5f33..84bc465d31aa 100644 --- a/drivers/clk/uniphier/clk-uniphier-core.c +++ b/drivers/clk/uniphier/clk-uniphier-core.c @@ -79,7 +79,7 @@ static int uniphier_clk_probe(struct platform_device *pdev) hw_data->num = clk_num; /* avoid returning NULL for unused idx */ - for (; clk_num >= 0; clk_num--) + while (--clk_num >= 0) hw_data->hws[clk_num] = ERR_PTR(-EINVAL); for (p = data; p->name; p++) { |