Skip to content

Commit 9450576

Browse files
committed
fat: fix stack frame size warnings in KUnit tests
The kernel test robot reported that on hexagon with clang, several test functions in fat_test.c exceed the 1280-byte stack frame limit. The root cause is the compound literal assignment in fat_test_set_time_offset(): *sbi = (struct msdos_sb_info){}; struct msdos_sb_info contains two hash tables of 256 hlist_head entries (FAT_HASH_SIZE), making it several kilobytes. The compound literal creates a temporary on the stack, and when clang inlines fat_test_set_time_offset() into each test function, the large temporary inflates every caller's stack frame beyond the limit. Replace the compound literal with memset() which zeroes the struct in-place without a stack temporary. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202603251755.4UYY1Rcd-lkp@intel.com/ Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 4bbf3f5 commit 9450576

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/fat/fat_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ KUNIT_ARRAY_PARAM(fat_truncate_atime, truncate_atime_test_cases,
218218

219219
static void fat_test_set_time_offset(struct msdos_sb_info *sbi, int time_offset)
220220
{
221-
*sbi = (struct msdos_sb_info){};
221+
memset(sbi, 0, sizeof(*sbi));
222222
sbi->options.tz_set = 1;
223223
sbi->options.time_offset = time_offset;
224224
}

0 commit comments

Comments
 (0)