Skip to content

Commit

Permalink
filemap: avoid truncating 64-bit offset to 32 bits
Browse files Browse the repository at this point in the history
on 32-bit kernels, folio_seek_hole_data() was inadvertently truncating a
64-bit value to 32 bits, leading to a possible infinite loop when writing
to an xfs filesystem.

Signed-off-by: Marco Nelissen <[email protected]>
  • Loading branch information
marcone authored and pelwell committed Jan 4, 2025
1 parent de92e4b commit a40c744
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3037,7 +3037,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas,
if (ops->is_partially_uptodate(folio, offset, bsz) ==
seek_data)
break;
start = (start + bsz) & ~(bsz - 1);
start = (start + bsz) & ~((u64)bsz - 1);
offset += bsz;
} while (offset < folio_size(folio));
unlock:
Expand Down

0 comments on commit a40c744

Please sign in to comment.