Re: [PATCH] fat: avoid stack overflow warning
From: Christian Brauner
Date: Thu May 21 2026 - 07:49:23 EST
On Fri, May 15, 2026 at 10:44:46PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> Building the fat kunit tests on with -fsanitize=alignment
> reveals some rather excessive stack usage:
>
> fs/fat/fat_test.c: In function 'fat_clus_to_blknr_test':
> fs/fat/fat_test.c:33:1: error: the frame size of 4736 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
> 33 | }
> | ^
> fs/fat/fat_test.c: In function 'fat_get_blknr_offset_test':
> fs/fat/fat_test.c:52:1: error: the frame size of 4800 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>
> The problem is clearly related to the on-stack copy of a local
> msdos_sb_info structure. Avoid this by making that copy
> 'static const' and changing the called functions to accept
> a constant input.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
What is this based on, Arnd? I'm getting errors applying this.