* [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf()
@ 2026-02-18 8:16 Felix Gu
2026-02-18 11:14 ` Brian Masney
0 siblings, 1 reply; 3+ messages in thread
From: Felix Gu @ 2026-02-18 8:16 UTC (permalink / raw)
To: Ryan Chen, Joel Stanley, Michael Turquette, Stephen Boyd,
Andrew Jeffery, Brian Masney
Cc: linux-clk, linux-aspeed, linux-arm-kernel, linux-kernel, Felix Gu
devm_kasprintf() can return NULL on memory allocation failure.
Check the return value and return -ENOMEM if allocation fails in
ast2700_soc_clk_probe().
Fixes: fdc1eb624ddc ("clk: aspeed: add AST2700 clock driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/clk/aspeed/clk-ast2700.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/aspeed/clk-ast2700.c b/drivers/clk/aspeed/clk-ast2700.c
index bbb2b571eb72..011f8be03edc 100644
--- a/drivers/clk/aspeed/clk-ast2700.c
+++ b/drivers/clk/aspeed/clk-ast2700.c
@@ -901,6 +901,8 @@ static int ast2700_soc_clk_probe(struct platform_device *pdev)
clk_ctrl->clk_data = clk_data;
reset_name = devm_kasprintf(dev, GFP_KERNEL, "reset%d", clk_data->scu);
+ if (!reset_name)
+ return -ENOMEM;
clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, clk_data->nr_clks),
GFP_KERNEL);
---
base-commit: fe9e3edb6a215515d1148d32a5c445c5bdd7916f
change-id: 20260218-ast2700-6cf87db729f0
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf()
2026-02-18 8:16 [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf() Felix Gu
@ 2026-02-18 11:14 ` Brian Masney
2026-02-23 0:34 ` Ryan Chen
0 siblings, 1 reply; 3+ messages in thread
From: Brian Masney @ 2026-02-18 11:14 UTC (permalink / raw)
To: Felix Gu
Cc: Ryan Chen, Joel Stanley, Michael Turquette, Stephen Boyd,
Andrew Jeffery, linux-clk, linux-aspeed, linux-arm-kernel,
linux-kernel
On Wed, Feb 18, 2026 at 04:16:37PM +0800, Felix Gu wrote:
> devm_kasprintf() can return NULL on memory allocation failure.
>
> Check the return value and return -ENOMEM if allocation fails in
> ast2700_soc_clk_probe().
>
> Fixes: fdc1eb624ddc ("clk: aspeed: add AST2700 clock driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf()
2026-02-18 11:14 ` Brian Masney
@ 2026-02-23 0:34 ` Ryan Chen
0 siblings, 0 replies; 3+ messages in thread
From: Ryan Chen @ 2026-02-23 0:34 UTC (permalink / raw)
To: Brian Masney, Felix Gu
Cc: Joel Stanley, Michael Turquette, Stephen Boyd, Andrew Jeffery,
linux-clk@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
> On Wed, Feb 18, 2026 at 04:16:37PM +0800, Felix Gu wrote:
> > devm_kasprintf() can return NULL on memory allocation failure.
> >
> > Check the return value and return -ENOMEM if allocation fails in
> > ast2700_soc_clk_probe().
> >
> > Fixes: fdc1eb624ddc ("clk: aspeed: add AST2700 clock driver")
> > Signed-off-by: Felix Gu <ustc.gu@gmail.com>
>
> Reviewed-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-23 0:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 8:16 [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf() Felix Gu
2026-02-18 11:14 ` Brian Masney
2026-02-23 0:34 ` Ryan Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox