* [PATCH] iio: osf: avoid a large stack frame in osf_core_init
[not found] <202610191514.fRYyu0HX-lkp@intel.com>
@ 2026-10-19 9:58 ` Jinseob Kim
2026-10-20 7:50 ` Joshua Crofts
0 siblings, 1 reply; 2+ messages in thread
From: Jinseob Kim @ 2026-10-19 9:58 UTC (permalink / raw)
To: jic23
Cc: linux-iio, dlechner, nuno.sa, andy, linux-kernel, lkp,
oe-kbuild-all, llvm
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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610191514.fRYyu0HX-lkp@intel.com/
Assisted-by: LLM
Signed-off-by: Jinseob Kim <kimjinseob88@gmail.com>
---
drivers/iio/sensorhubs/osf/osf_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/sensorhubs/osf/osf_core.c b/drivers/iio/sensorhubs/osf/osf_core.c
index 4f73ff5e9572..62b086f67e6f 100644
--- a/drivers/iio/sensorhubs/osf/osf_core.c
+++ b/drivers/iio/sensorhubs/osf/osf_core.c
@@ -16,9 +16,8 @@
void osf_core_init(struct osf_device *osf, struct device *dev)
{
- *osf = (struct osf_device) {
- .dev = dev,
- };
+ memset(osf, 0, sizeof(*osf));
+ osf->dev = dev;
mutex_init(&osf->latest_lock);
}
base-commit: 43ffda3c7f8456bbe641ae8249a077a361b97880
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: osf: avoid a large stack frame in osf_core_init
2026-10-19 9:58 ` [PATCH] iio: osf: avoid a large stack frame in osf_core_init Jinseob Kim
@ 2026-10-20 7:50 ` Joshua Crofts
0 siblings, 0 replies; 2+ messages in thread
From: Joshua Crofts @ 2026-10-20 7:50 UTC (permalink / raw)
To: Jinseob Kim
Cc: jic23, linux-iio, dlechner, nuno.sa, andy, linux-kernel, lkp,
oe-kbuild-all, llvm
On Mon, 19 Oct 2026 18:58:49 +0900
Jinseob Kim <kimjinseob88@gmail.com> 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@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202610191514.fRYyu0HX-lkp@intel.com/
> Assisted-by: LLM
> Signed-off-by: Jinseob Kim <kimjinseob88@gmail.com>
> ---
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-20 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <202610191514.fRYyu0HX-lkp@intel.com>
2026-10-19 9:58 ` [PATCH] iio: osf: avoid a large stack frame in osf_core_init Jinseob Kim
2026-10-20 7:50 ` Joshua Crofts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox