]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: fix uninitialized pointer in ntfs_write_mft_block
authorNamjae Jeon <linkinjeon@kernel.org>
Fri, 10 Apr 2026 14:49:01 +0000 (23:49 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Sat, 18 Apr 2026 02:33:07 +0000 (11:33 +0900)
commit545834ac412fb42d41a41442aee7998c1d2dcced
tree96937f623cca686a4d9391d8ab75896677524f4f
parent8a59a2d84fa3de2b4bbb8759b52e62c9c06d9d32
ntfs: fix uninitialized pointer in ntfs_write_mft_block

Smatch reported that the variable rl could be used uninitialized in
ntfs_write_mft_block(). After analyzing the code,
when vol->cluster_size == NTFS_BLOCK_SIZE (512), it is smaller than
folio_size, so rl is guaranteed to be initialized. If vol->cluster_size
is larger, the condition to access rl becomes false, so a runtime error is
not expected to occur. However, to make the static checker happy,
this patch initializes rl to NULL and adds an explicit check before
its usage.

Reported-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/mft.c