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

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>
This commit is contained in:
Gen Zhang 2019-05-28 10:18:51 +08:00 committed by Maxime Ripard
parent a188339ca5
commit fcdf445ff4
No known key found for this signature in database
GPG Key ID: E3EF0D6F671851C5
1 changed files with 2 additions and 0 deletions

View File

@ -989,6 +989,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;