Re: [PATCH] iio: osf: avoid a large stack frame in osf_core_init

From: Jonathan Cameron

Date: Fri Oct 23 2026 - 22:39:33 EST


On Tue, 20 Oct 2026 09:50:39 +0200
Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:

> On Mon, 19 Oct 2026 18:58:49 +0900
> Jinseob Kim <kimjinseob88@xxxxxxxxx> wrote:
>
> > Clang reports a 1344-byte stack frame in osf_core_init() for
> > hexagon-allmodconfig, exceeding CONFIG_FRAME_WARN=1280.
> >
> > The aggregate assignment materializes a temporary struct osf_device on
> > the stack and copies it to the destination. With the mutex and caches
> > added by the IIO support, this structure is 1328 bytes in the reported
> > configuration.
> >
> > Clear the destination directly, then set dev and initialize latest_lock
> > as before. This preserves zero initialization of all other fields,
> > including when the core is reinitialized for a new session, without the
> > large temporary object.
> >
> > With the reported Clang 24.0.0git compiler and Hexagon configuration, the
> > frame decreases from 1344 to 8 bytes and the warning disappears.
> >
> > Fixes: 7329986669f2 ("iio: osf: add IIO devices from capability reports")
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202610191514.fRYyu0HX-lkp@xxxxxxxxx/
> > Assisted-by: LLM
Dropped this lot because it all gets messy with an unstable commit.
I made the Closes into a Link to retain the info.

Applied to the testing branch of iio.git

Thanks,

Jonathan



> > Signed-off-by: Jinseob Kim <kimjinseob88@xxxxxxxxx>
> > ---
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
>