Re: [PATCH] ntfs: reduce stack usage in ntfs_write_mft_block()
From: Namjae Jeon
Date: Wed Mar 04 2026 - 05:50:26 EST
On Wed, Mar 4, 2026 at 5:38 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> The use of two large arrays in this function makes the stack frame exceed the
> warning limit in some configurations, especially with KASAN enabled. When
> CONFIG_PAGE_SIZE is set to 65536, each of the arrays contains 128 pointers,
> so the combined size is 2KB:
>
> fs/ntfs/mft.c: In function 'ntfs_write_mft_block.isra':
> fs/ntfs/mft.c:2891:1: error: the frame size of 2640 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>
> Use dynamic allocation of these arrays to avoid getting into dangerously
> high stack usage.
>
> Unfortunately, allocating memory in the writepages() code path can be
> problematic in case of low memory situations, so it would be better to
> rework the code more widely to avoid the allocation entirely.
>
> Fixes: 115380f9a2f9 ("ntfs: update mft operations")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Applied it #ntfs-next.
Thanks!