Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntfs: fix potential 32-bit truncation in ntfs_write_cb()

Smatch warned that the bitwise negation in ntfs_write_cb() might lead to
unintended truncation. Casting the block size to loff_t before bitwise
negation prevents the upper 32 bits of pos from being incorrectly zeroed
out during the calculation of new_vcn.

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

authored by

Dan Carpenter and committed by
Namjae Jeon
660b9823 dacc1802

+2 -1
+2 -1
fs/ntfs/compress.c
··· 1374 1374 bio_size = insz; 1375 1375 } 1376 1376 1377 - new_vcn = ntfs_bytes_to_cluster(vol, pos & ~(ni->itype.compressed.block_size - 1)); 1377 + new_vcn = ntfs_bytes_to_cluster(vol, 1378 + pos & ~((loff_t)ni->itype.compressed.block_size - 1)); 1378 1379 new_length = ntfs_bytes_to_cluster(vol, round_up(bio_size, vol->cluster_size)); 1379 1380 1380 1381 err = ntfs_non_resident_attr_punch_hole(ni, new_vcn, ni->itype.compressed.block_clusters);