[PATCH 09/10] clk: keystone: sci-clk: Check allocation failure before copying clock array

Jerome Brunet jbrunet at baylibre.com
Thu Dec 3 10:24:33 PST 2026


On 2026-12-03 10:21 -0600, Andrew Davis wrote:
> On 11/27/26 1:25 PM, Lee Jones wrote:
> > ti_sci_scan_clocks_from_fw() calls devm_kmalloc_objs() without checking
> > for NULL before passing tmp_clks into memcpy(), and invokes memcpy()
> > with a NULL source pointer on the initial iteration when max_clks is
> > zero.
> > 
> > Return -ENOMEM if devm_kmalloc_objs() fails, and only copy and free the
> > previous array when max_clks is non-zero.
> > 
> > Fixes: 3c13933c6033 ("clk: keystone: sci-clk: add support for dynamically probing clocks")
> > Closes: https://sashiko.dev/#/bug/linux-4e2ecf16-17f1-4188-880c-c714a1bf588c
> > Cc: stable at vger.kernel.org
> > Signed-off-by: Lee Jones <lee at kernel.org>
> > ---
> 
> LGTM,
> 
> Acked-by: Andrew Davis <afd at ti.com>
> 
> Side note though, this function `ti_sci_scan_clocks_from_fw()` is an unused
> legacy function that was kept around for possible debugging. Now that AI
> is finding bugs in it and causing churn, might be time to just delete the
> whole function..

Please submit this change. This is something we can't figure out without your
help. Thanks

-- 
Jerome




More information about the linux-arm-kernel mailing list