From: Slavin Liu <bolin.liu@seu.edu.cn>
To: nm@ti.com, kristo@kernel.org, ssantosh@kernel.org,
sboyd@kernel.org, bmasney+clk@redhat.com,
jbrunet+clk@baylibre.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
bolin.liu@seu.edu.cn
Subject: [PATCH RFC] clk: keystone: sci-clk: check the growing discovery array
Date: Fri, 11 Sep 2026 14:09:06 +0800 [thread overview]
Message-ID: <20260911060906.94179-1-bolin.liu@seu.edu.cn> (raw)
Check each newly allocated discovery array before copying existing
entries or publishing its first element. Devres releases prior storage
when the probe fails.
Detected by static analysis and reviewed with AI-assisted source auditing.
Fixes: 3c13933c6033 ("clk: keystone: sci-clk: add support for dynamically probing clocks")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
drivers/clk/keystone/sci-clk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 9d2094bd48e3..dad2fb67c405 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -496,6 +496,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
tmp_clks = devm_kmalloc_array(dev, max_clks + 64,
sizeof(sci_clk),
GFP_KERNEL);
+ if (!tmp_clks)
+ return -ENOMEM;
memcpy(tmp_clks, clks, max_clks * sizeof(sci_clk));
if (max_clks)
devm_kfree(dev, clks);
next reply other threads:[~2026-09-11 6:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 6:09 Slavin Liu [this message]
2026-09-11 19:36 ` [PATCH RFC] clk: keystone: sci-clk: check the growing discovery array Nishanth Menon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260911060906.94179-1-bolin.liu@seu.edu.cn \
--to=bolin.liu@seu.edu.cn \
--cc=bmasney+clk@redhat.com \
--cc=jbrunet+clk@baylibre.com \
--cc=kristo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nm@ti.com \
--cc=sboyd@kernel.org \
--cc=ssantosh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox