Re: [PATCH treewide 4/5] iio: frequency: adf4377: Make sure clk_init_data is fully initialized
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.infradead.lists.linux-amlogic,dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-clk,org.kernel.vger.linux-hwmon |
|---|---|
| Message-ID | <CAMuHMdWpHicDvj7tvKJB7SCnVJ2gRmidUeTwA+hHxnhsXs7h=w@mail.gmail.com> |
Hi Sashiko, On Wed, 19 Aug 2026 at 21:13, <[email protected]> wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > > Pre-existing issues: > - [High] Incomplete fix for uninitialized stack variables: `struct clk_parent_data parent_data` remains uninitialized on the stack, leading to a kernel crash during clock registration. > -- > > --- Patch [4]: [PATCH treewide 4/5] iio: frequency: adf4377: Make sure clk_init_data is fully initialized --- > commit 99e024a77f5bce5921d3c6b46054263aa450610d > Author: Geert Uytterhoeven <[email protected]> > > iio: frequency: adf4377: Make sure clk_init_data is fully initialized > > This commit initializes the clk_init_data structure in > adf4377_clk_register() to zero. This prevents crashes caused by > uninitialized fields like parent_names when CONFIG_INIT_STACK_ALL_PATTERN > or CONFIG_INIT_STACK_NONE is enabled. > > > diff --git a/drivers/iio/frequency/adf4377.c b/drivers/iio/frequency/adf4377.c > > --- a/drivers/iio/frequency/adf4377.c > > +++ b/drivers/iio/frequency/adf4377.c > > @@ -999,7 +999,7 @@ static int adf4377_clk_register(struct adf4377_state *st) > > { > > struct spi_device *spi = st->spi; > > struct device *dev = &spi->dev; > > - struct clk_init_data init; > > + struct clk_init_data init = {}; > > struct clk_parent_data parent_data; > > [Severity: High] > This is a pre-existing issue, but does this struct clk_parent_data also > need to be zero-initialized? > > Only fw_name is explicitly assigned below, leaving name, hw, and index > populated with stack garbage. When adf4377_clk_register() passes this to > the clock framework, clk_core_populate_parent_map() will read > parent_data.name and pass it to clk_cpy_name(), which ultimately calls > strlen() and can cause a page fault during probe. Yes, parent_data has the same issue. As Jonathan will rebase against rc1 anyway, I will send a v2. Thanks! > > [ ... ] > > > parent_data.fw_name = "ref_in"; > > > > init.ops = &adf4377_clk_ops; > > init.parent_data = &parent_data; > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic