Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Philipp Hahn and committed by
Namjae Jeon
3dce5bb8 81440a74

+1 -1
+1 -1
fs/exfat/dir.c
··· 249 249 */ 250 250 if (err == -EIO) { 251 251 cpos += 1 << (sb->s_blocksize_bits); 252 - cpos &= ~(sb->s_blocksize - 1); 252 + cpos &= ~(loff_t)(sb->s_blocksize - 1); 253 253 } 254 254 255 255 err = -EIO;