]> git.ipfire.org Git - thirdparty/linux.git/commit
erofs: fix offset truncation when shifting pgoff on 32-bit platforms
authorGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 20 Apr 2026 03:46:12 +0000 (11:46 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 21 Apr 2026 08:56:08 +0000 (16:56 +0800)
commitc99493ce409c3b98fec1616dbcf24c102e006deb
treef1c95ff458339673a37b504a6af6bb10827fa3c8
parentd18a3b5d337fa412a38e776e6b4b857a58836575
erofs: fix offset truncation when shifting pgoff on 32-bit platforms

On 32-bit platforms, pgoff_t is 32 bits wide, so left-shifting
large arbitrary pgoff_t values by PAGE_SHIFT performs 32-bit arithmetic
and silently truncates the result for pages beyond the 4 GiB boundary.

Cast the page index to loff_t before shifting to produce a correct
64-bit byte offset.

Fixes: 386292919c25 ("erofs: introduce readmore decompression strategy")
Fixes: 307210c262a2 ("erofs: verify metadata accesses for file-backed mounts")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/data.c
fs/erofs/zdata.c