Skip to content

Commit

Permalink
fs/ntfs3: Don't clear upper bits accidentally in log_replay()
Browse files Browse the repository at this point in the history
The "vcn" variable is a 64 bit.  The "log->clst_per_page" variable is a
u32.  This means that the mask accidentally clears out the high 32 bits
when it was only supposed to clear some low bits.  Fix this by adding a
cast to u64.

Fixes: b46acd6 ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
  • Loading branch information
Dan Carpenter authored and aalexandrovich committed Jun 10, 2022
1 parent 19e890f commit 9260343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ntfs3/fslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -5057,7 +5057,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
goto add_allocated_vcns;

vcn = le64_to_cpu(lrh->target_vcn);
vcn &= ~(log->clst_per_page - 1);
vcn &= ~(u64)(log->clst_per_page - 1);

add_allocated_vcns:
for (i = 0, vcn = le64_to_cpu(lrh->target_vcn),
Expand Down

0 comments on commit 9260343

Please sign in to comment.