* [PATCH] clk: uniphier: fix memory overrun bug
@ 2016-10-19 11:49 Masahiro Yamada
2016-10-19 20:14 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2016-10-19 11:49 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
drivers/clk/uniphier/clk-uniphier-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c
index f4e0f6b..84bc465 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++) {
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] clk: uniphier: fix memory overrun bug
2016-10-19 11:49 [PATCH] clk: uniphier: fix memory overrun bug Masahiro Yamada
@ 2016-10-19 20:14 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-10-19 20:14 UTC (permalink / raw)
To: linux-arm-kernel
On 10/19, Masahiro Yamada wrote:
> 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>
> ---
Applied to clk-fixes
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-19 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-19 11:49 [PATCH] clk: uniphier: fix memory overrun bug Masahiro Yamada
2016-10-19 20:14 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).