]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fat: avoid stack overflow warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 15 May 2026 20:44:46 +0000 (22:44 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 9 Jul 2026 22:48:55 +0000 (15:48 -0700)
commite1a1729419e3e440668dbc1ae95b0dc2004172fe
tree746d38e3537188c030b96a139536c9b188748776
parent1292c0ecb1caefb8ca064a3639d5673991e8810c
fat: avoid stack overflow warning

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.

Link: https://lore.kernel.org/20260515204456.2692208-1-arnd@kernel.org
Fixes: 410002f8139c ("kunit: fat: test cluster and directory i_pos layout helpers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Adi Nata <adinata.softwareengineer@gmail.com>
Cc: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/fat/fat.h
fs/fat/fat_test.c