]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: reduce stack usage in ntfs_write_mft_block()
authorArnd Bergmann <arnd@arndb.de>
Wed, 4 Mar 2026 08:38:32 +0000 (09:38 +0100)
committerNamjae Jeon <linkinjeon@kernel.org>
Wed, 4 Mar 2026 10:37:13 +0000 (19:37 +0900)
commitf462fdf3d6a405ada5cf51241d56a47ead152968
tree27986008bae97341287b0d164140eaa13f982fd2
parenta8fde8be9aa8e5f10ef73b59b2ad4fba585ccdc5
ntfs: reduce stack usage in ntfs_write_mft_block()

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@arndb.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/mft.c