Skip to contentSkip to conversation

fat-avoid-stack-overflow-warning.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jul 9

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: fat: avoid stack overflow warning
has been removed from the -mm tree. Its filename was
fat-avoid-stack-overflow-warning.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Arnd Bergmann <[email protected]>
Subject: fat: avoid stack overflow warning
Date: Fri, 15 May 2026 22:44:46 +0200

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.

Fixes 410002f8139c ("kunit: fat: test cluster and directory i_pos layout helpers")
Cc Christian Brauner <[email protected]>
Cc Jan Kara <[email protected]>
Cc Adi Nata <[email protected]>
Cc David Laight <[email protected]>

---

 fs/fat/fat.h      |    4 ++--
 fs/fat/fat_test.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
fs/fat/fat.h renamed from fs/fat/fat.h~fat-avoid-stack-overflow-warning +2 -2
@@ -249,13 +249,13 @@ static inline unsigned char fat_checksum
 	return s;
 }
 
-static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus)
+static inline sector_t fat_clus_to_blknr(const struct msdos_sb_info *sbi, int clus)
 {
 	return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus
 		+ sbi->data_start;
 }
 
-static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi,
+static inline void fat_get_blknr_offset(const struct msdos_sb_info *sbi,
 				loff_t i_pos, sector_t *blknr, int *offset)
 {
 	*blknr = i_pos >> sbi->dir_per_block_bits;
fs/fat/fat_test.c renamed from fs/fat/fat_test.c~fat-avoid-stack-overflow-warning +2 -2
@@ -22,7 +22,7 @@ static void fat_checksum_test(struct kun
 
 static void fat_clus_to_blknr_test(struct kunit *test)
 {
-	struct msdos_sb_info sbi = {
+	static const struct msdos_sb_info sbi = {
 		.sec_per_clus = 4,
 		.data_start = 100,
 	};
@@ -34,7 +34,7 @@ static void fat_clus_to_blknr_test(struc
 
 static void fat_get_blknr_offset_test(struct kunit *test)
 {
-	struct msdos_sb_info sbi = {
+	static const struct msdos_sb_info sbi = {
 		.dir_per_block = 16,
 		.dir_per_block_bits = 4,
 	};

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-reduce-kernel-stack-usage.patch