]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ntfs: fix uninitialized variable in ntfs_write_simple_iomap_begin_non_resident
authorNamjae Jeon <linkinjeon@kernel.org>
Fri, 10 Apr 2026 11:29:44 +0000 (20:29 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Sat, 18 Apr 2026 02:33:05 +0000 (11:33 +0900)
Smatch reported that err could be used uninitialized if the code path
does not enter the first ntfs_zero_range() block.

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/iomap.c

index 621645fbbf2ed4cfcf12fce883437fe50bd7360a..3d1458dea90f90fccd7a6cd61c08ee0374c52310 100644 (file)
@@ -384,7 +384,7 @@ static int ntfs_write_simple_iomap_begin_non_resident(struct inode *inode, loff_
        loff_t vcn_ofs, rl_length;
        struct runlist_element *rl, *rlc;
        bool is_retry = false;
-       int err;
+       int err = 0;
        s64 vcn, lcn;
        s64 max_clu_count =
                ntfs_bytes_to_cluster(vol, round_up(length, vol->cluster_size));