* + fat-avoid-stack-overflow-warning.patch added to mm-hotfixes-unstable branch
@ 2026-07-02 0:51 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-07-02 0:51 UTC (permalink / raw)
To: mm-commits, jack, hirofumi, david.laight.linux, brauner,
adinata.softwareengineer, arnd, akpm
The patch titled
Subject: fat: avoid stack overflow warning
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
fat-avoid-stack-overflow-warning.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fat-avoid-stack-overflow-warning.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Arnd Bergmann <arnd@arndb.de>
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.
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 | 4 ++--
fs/fat/fat_test.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
--- a/fs/fat/fat.h~fat-avoid-stack-overflow-warning
+++ a/fs/fat/fat.h
@@ -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;
--- a/fs/fat/fat_test.c~fat-avoid-stack-overflow-warning
+++ a/fs/fat/fat_test.c
@@ -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 arnd@arndb.de are
fat-avoid-stack-overflow-warning.patch
mm-damon-core-reduce-kernel-stack-usage.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-02 0:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 0:51 + fat-avoid-stack-overflow-warning.patch added to mm-hotfixes-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.