[PATCH RFC] clk: keystone: sci-clk: check the growing discovery array
Slavin Liu
bolin.liu at seu.edu.cn
Thu Sep 10 23:09:06 PDT 2026
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 at 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);
More information about the linux-arm-kernel
mailing list