Re: [PATCH 09/10] clk: keystone: sci-clk: Check allocation failure before copying clock array
From: Jerome Brunet
Date: Thu Dec 03 2026 - 13:24:40 EST
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@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> > ---
>
> LGTM,
>
> Acked-by: Andrew Davis <afd@xxxxxx>
>
> 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