mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
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>
This commit is contained in:
parent
dacc18029e
commit
660b982305
|
|
@ -1374,7 +1374,8 @@ static int ntfs_write_cb(struct ntfs_inode *ni, loff_t pos, struct page **pages,
|
|||
bio_size = insz;
|
||||
}
|
||||
|
||||
new_vcn = ntfs_bytes_to_cluster(vol, pos & ~(ni->itype.compressed.block_size - 1));
|
||||
new_vcn = ntfs_bytes_to_cluster(vol,
|
||||
pos & ~((loff_t)ni->itype.compressed.block_size - 1));
|
||||
new_length = ntfs_bytes_to_cluster(vol, round_up(bio_size, vol->cluster_size));
|
||||
|
||||
err = ntfs_non_resident_attr_punch_hole(ni, new_vcn, ni->itype.compressed.block_clusters);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user