diff options
author | Gen Zhang <blackgod016574@gmail.com> | 2019-05-28 10:18:51 +0800 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@bootlin.com> | 2019-05-29 10:04:55 +0200 |
commit | fcdf445ff42f036d22178b49cf64e92d527c1330 (patch) | |
tree | 7ca2863d61e57b020fd1a57601e2b50756bd1579 | |
parent | a188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff) | |
download | linux-fcdf445ff42f036d22178b49cf64e92d527c1330.tar.gz linux-fcdf445ff42f036d22178b49cf64e92d527c1330.tar.bz2 linux-fcdf445ff42f036d22178b49cf64e92d527c1330.zip |
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>
-rw-r--r-- | drivers/clk/sunxi/clk-sunxi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index f5b1c0067365..830bfb7f5e6b 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -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; |