* [PATCH] clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup()
@ 2019-05-28 2:18 ` Gen Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Gen Zhang @ 2019-05-28 2:18 UTC (permalink / raw)
To: emilio, mturquette, sboyd, maxime.ripard, wens
Cc: linux-clk, linux-arm-kernel, linux-kernel
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>
---
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index f5b1c00..830bfb7 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;
---
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup()
@ 2019-05-28 2:18 ` Gen Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Gen Zhang @ 2019-05-28 2:18 UTC (permalink / raw)
To: emilio, mturquette, sboyd, maxime.ripard, wens
Cc: linux-clk, linux-arm-kernel, linux-kernel
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>
---
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index f5b1c00..830bfb7 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;
---
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup()
2019-05-28 2:18 ` Gen Zhang
@ 2019-05-29 8:05 ` Maxime Ripard
-1 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2019-05-29 8:05 UTC (permalink / raw)
To: Gen Zhang
Cc: emilio, mturquette, sboyd, wens, linux-clk, linux-arm-kernel,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
On Tue, May 28, 2019 at 10:18:51AM +0800, Gen Zhang wrote:
> 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>
Applied, thanks
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup()
@ 2019-05-29 8:05 ` Maxime Ripard
0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2019-05-29 8:05 UTC (permalink / raw)
To: Gen Zhang
Cc: emilio, mturquette, linux-kernel, sboyd, wens, linux-clk,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 360 bytes --]
On Tue, May 28, 2019 at 10:18:51AM +0800, Gen Zhang wrote:
> 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>
Applied, thanks
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-29 8:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 2:18 [PATCH] clk-sunxi: fix a missing-check bug in sunxi_divs_clk_setup() Gen Zhang
2019-05-28 2:18 ` Gen Zhang
2019-05-29 8:05 ` Maxime Ripard
2019-05-29 8:05 ` Maxime Ripard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.