linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe
@ 2024-11-14  7:28 Charles Han
  2024-11-14 11:14 ` Martin Povišer
  2024-11-14 20:31 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Han @ 2024-11-14  7:28 UTC (permalink / raw)
  To: povik+lin, marcan, sven, alyssa
  Cc: mturquette, sboyd, asahi, linux-arm-kernel, linux-clk,
	Charles Han

Add NULL check in applnco_probe, to handle kernel NULL pointer
dereference error.

Fixes: 6641057d5dba ("clk: clk-apple-nco: Add driver for Apple NCO")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
---
 drivers/clk/clk-apple-nco.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk-apple-nco.c b/drivers/clk/clk-apple-nco.c
index 39472a51530a..457a48d48941 100644
--- a/drivers/clk/clk-apple-nco.c
+++ b/drivers/clk/clk-apple-nco.c
@@ -297,6 +297,9 @@ static int applnco_probe(struct platform_device *pdev)
 		memset(&init, 0, sizeof(init));
 		init.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 						"%s-%d", np->name, i);
+		if (!init.name)
+			return -ENOMEM;
+
 		init.ops = &applnco_ops;
 		init.parent_data = &pdata;
 		init.num_parents = 1;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe
  2024-11-14  7:28 [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe Charles Han
@ 2024-11-14 11:14 ` Martin Povišer
  2024-11-14 20:31 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Povišer @ 2024-11-14 11:14 UTC (permalink / raw)
  To: Charles Han
  Cc: marcan, sven, alyssa, mturquette, sboyd, asahi, linux-arm-kernel,
	linux-clk

Thanks.

Reviewed-by: Martin Povišer <povik+lin@cutebit.org>

Martin

> On 14. 11. 2024, at 8:28, Charles Han <hanchunchao@inspur.com> wrote:
> 
> Add NULL check in applnco_probe, to handle kernel NULL pointer
> dereference error.
> 
> Fixes: 6641057d5dba ("clk: clk-apple-nco: Add driver for Apple NCO")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
> drivers/clk/clk-apple-nco.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clk/clk-apple-nco.c b/drivers/clk/clk-apple-nco.c
> index 39472a51530a..457a48d48941 100644
> --- a/drivers/clk/clk-apple-nco.c
> +++ b/drivers/clk/clk-apple-nco.c
> @@ -297,6 +297,9 @@ static int applnco_probe(struct platform_device *pdev)
> memset(&init, 0, sizeof(init));
> init.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> "%s-%d", np->name, i);
> + if (!init.name)
> + return -ENOMEM;
> +
> init.ops = &applnco_ops;
> init.parent_data = &pdata;
> init.num_parents = 1;
> -- 
> 2.31.1
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe
  2024-11-14  7:28 [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe Charles Han
  2024-11-14 11:14 ` Martin Povišer
@ 2024-11-14 20:31 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2024-11-14 20:31 UTC (permalink / raw)
  To: Charles Han, alyssa, marcan, povik+lin, sven
  Cc: mturquette, asahi, linux-arm-kernel, linux-clk, Charles Han

Quoting Charles Han (2024-11-13 23:28:20)
> Add NULL check in applnco_probe, to handle kernel NULL pointer
> dereference error.
> 
> Fixes: 6641057d5dba ("clk: clk-apple-nco: Add driver for Apple NCO")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-14 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14  7:28 [PATCH] clk: clk-apple-nco: Add NULL check in applnco_probe Charles Han
2024-11-14 11:14 ` Martin Povišer
2024-11-14 20:31 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).