Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [jic23-iio:testing 55/58] drivers/iio/sensorhubs/osf/osf_core.c:17:6: warning: stack frame size (1344) exceeds limit (1280) in 'osf_core_init'
@ 2026-10-19  7:37 kernel test robot
  2026-10-19  9:58 ` [PATCH] iio: osf: avoid a large stack frame in osf_core_init Jinseob Kim
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-10-19  7:37 UTC (permalink / raw)
  To: Jinseob Kim; +Cc: llvm, oe-kbuild-all, Jonathan Cameron

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   43ffda3c7f8456bbe641ae8249a077a361b97880
commit: 2da37c28edc66848f7ff302011b765ae66ee8cf2 [55/58] iio: osf: add IIO devices from capability reports
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20261019/202610191514.fRYyu0HX-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 6719b9e31d6a93099612c474eec76d9f41d0275a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261019/202610191514.fRYyu0HX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610191514.fRYyu0HX-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/sensorhubs/osf/osf_core.c:17:6: warning: stack frame size (1344) exceeds limit (1280) in 'osf_core_init' [-Wframe-larger-than]
      17 | void osf_core_init(struct osf_device *osf, struct device *dev)
         |      ^
   1 warning generated.


vim +/osf_core_init +17 drivers/iio/sensorhubs/osf/osf_core.c

33efb787fb5f8c Jinseob Kim 2026-10-12  16  
33efb787fb5f8c Jinseob Kim 2026-10-12 @17  void osf_core_init(struct osf_device *osf, struct device *dev)
33efb787fb5f8c Jinseob Kim 2026-10-12  18  {
33efb787fb5f8c Jinseob Kim 2026-10-12  19  	*osf = (struct osf_device) {
33efb787fb5f8c Jinseob Kim 2026-10-12  20  		.dev = dev,
33efb787fb5f8c Jinseob Kim 2026-10-12  21  	};
2da37c28edc668 Jinseob Kim 2026-10-12  22  	mutex_init(&osf->latest_lock);
2da37c28edc668 Jinseob Kim 2026-10-12  23  }
2da37c28edc668 Jinseob Kim 2026-10-12  24  

:::::: The code at line 17 was first introduced by commit
:::::: 33efb787fb5f8cc2053b241375a97c219b399aa3 iio: osf: add UART transport and core receive path

:::::: TO: Jinseob Kim <kimjinseob88@gmail.com>
:::::: CC: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] iio: osf: avoid a large stack frame in osf_core_init
  2026-10-19  7:37 [jic23-iio:testing 55/58] drivers/iio/sensorhubs/osf/osf_core.c:17:6: warning: stack frame size (1344) exceeds limit (1280) in 'osf_core_init' kernel test robot
@ 2026-10-19  9:58 ` Jinseob Kim
  0 siblings, 0 replies; 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

end of thread, other threads:[~2026-10-19  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  7:37 [jic23-iio:testing 55/58] drivers/iio/sensorhubs/osf/osf_core.c:17:6: warning: stack frame size (1344) exceeds limit (1280) in 'osf_core_init' kernel test robot
2026-10-19  9:58 ` [PATCH] iio: osf: avoid a large stack frame in osf_core_init Jinseob Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox