clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup()

commit fcdf445ff4 upstream.

In sunxi_divs_clk_setup(), 'derived_name' is allocated by kstrndup().
It returns NULL when fails. 'derived_name' should be checked.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
This commit is contained in:
Gen Zhang 2019-05-28 10:18:51 +08:00 committed by Joseph Qi
parent 5cfae4b670
commit ab73d500f7
1 changed files with 2 additions and 0 deletions

View File

@ -988,6 +988,8 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node,
if (endp) {
derived_name = kstrndup(clk_name, endp - clk_name,
GFP_KERNEL);
if (!derived_name)
return NULL;
factors.name = derived_name;
} else {
factors.name = clk_name;