Message ID | 1382523448-29461-1-git-send-email-shaojie.sun@linaro.com |
---|---|
State | New |
Headers | show |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 1144e8c..fcb5c85 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1632,7 +1632,8 @@ int __clk_init(struct device *dev, struct clk *clk) hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { if (orphan->ops->get_parent) { i = orphan->ops->get_parent(orphan->hw); - if (!strcmp(clk->name, orphan->parent_names[i])) + if ((i >= 0) + && !strcmp(clk->name, orphan->parent_names[i])) __clk_reparent(orphan, clk); continue; }
For get_parent function may be return a below zero value to indicate that it could function a right value. In this condition orphan->parent_names[i] will lead system a access an unknown memory. Signed-off-by: Shaojie Sun <shaojie.sun@linaro.com> --- drivers/clk/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)