Skip to content

Commit 3dce5bb

Browse files
pmhahnnamjaejeon
authored andcommitted
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>
1 parent 81440a7 commit 3dce5bb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/exfat/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static int exfat_iterate(struct file *file, struct dir_context *ctx)
249249
*/
250250
if (err == -EIO) {
251251
cpos += 1 << (sb->s_blocksize_bits);
252-
cpos &= ~(sb->s_blocksize - 1);
252+
cpos &= ~(loff_t)(sb->s_blocksize - 1);
253253
}
254254

255255
err = -EIO;

0 commit comments

Comments
 (0)