Skip to contentSkip to conversation

wifi: iwlegacy: work around excessive stack usage on clang/kasan

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 20, 2025 – Jun 23, 2025 Intel wireless 3945ABG/bg, 4965AGN (iwlegacy)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: iwlegacy: work around excessive stack usage on clang/kasan

From: Arnd Bergmann <[email protected]>

In some rare randconfig builds, I seem to trigger a bug in clang where it unrolls a loop but then runs out of registers, which then get spilled to the stack:

net/wireless/intel/iwlegacy/4965-rs.c:2262:1: error: stack frame size (1696) exceeds limit (1280) in 'il4965_rs_rate_init' [-Werror,-Wframe-larger-than]

This seems to be the same one I saw in the omapdrm driver, and there is an easy workaround by not inlining the il4965_rs_rate_scale_clear_win function.

---
 drivers/net/wireless/intel/iwlegacy/4965-rs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlegacy/4965-rs.c +2 -1
index 0e5130d1fccd..031d88bf6393 100644
@@ -203,7 +203,8 @@ il4965_rs_extract_rate(u32 rate_n_flags)
 	return (u8) (rate_n_flags & 0xFF);
 }
 
-static void
+/* noinline works around https://github.com/llvm/llvm-project/issues/143908 */
+static noinline_for_stack void
 il4965_rs_rate_scale_clear_win(struct il_rate_scale_data *win)
 {
 	win->data = 0;
Signature · 1 line
2.39.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some rare randconfig builds, I seem to trigger a bug in clang where it unrolls a loop but then runs out of registers, which then get spilled to the stack:

Quoted 8 lines

net/wireless/intel/iwlegacy/4965-rs.c:2262:1: error: stack frame size (1696) exceeds limit (1280) in 'il4965_rs_rate_init' [-Werror,-Wframe-larger-than]

This seems to be the same one I saw in the omapdrm driver, and there is an easy workaround by not inlining the il4965_rs_rate_scale_clear_win function.

Quoted 21 lines
---
 drivers/net/wireless/intel/iwlegacy/4965-rs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlegacy/4965-rs.c +2 -1
index 0e5130d1fccd..031d88bf6393 100644
@@ -203,7 +203,8 @@ il4965_rs_extract_rate(u32 rate_n_flags)
 	return (u8) (rate_n_flags & 0xFF);
 }
 
-static void
+/* noinline works around https://github.com/llvm/llvm-project/issues/143908 */
+static noinline_for_stack void
 il4965_rs_rate_scale_clear_win(struct il_rate_scale_data *win)
 {
 	win->data = 0;
Signature · 1 line
2.39.5