exfat: Fix bitwise operation having different size

cpos has type loff_t (long long), while s_blocksize has type u32. The
inversion wil happen on u32, the coercion to s64 happens afterwards and
will do 0-left-paddding, resulting in the upper bits getting masked out.

Cast s_blocksize to loff_t before negating it.

Found by static code analysis using Klocwork.

Signed-off-by: Philipp Hahn <phahn-oss@avm.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Philipp Hahn 2026-03-03 11:59:14 +01:00 committed by Namjae Jeon
parent 81440a740d
commit 3dce5bb82c

View File

@ -249,7 +249,7 @@ static int exfat_iterate(struct file *file, struct dir_context *ctx)
*/
if (err == -EIO) {
cpos += 1 << (sb->s_blocksize_bits);
cpos &= ~(sb->s_blocksize - 1);
cpos &= ~(loff_t)(sb->s_blocksize - 1);
}
err = -EIO;