]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
exfat: Fix bitwise operation having different size
authorPhilipp Hahn <phahn-oss@avm.de>
Tue, 3 Mar 2026 10:59:14 +0000 (11:59 +0100)
committerNamjae Jeon <linkinjeon@kernel.org>
Wed, 4 Mar 2026 10:23:59 +0000 (19:23 +0900)
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>
fs/exfat/dir.c

index 3a4853693d8bfda44be99eca2bca0de4132839d5..e710dd196e2f0c4d8eceb06d797789f640eadf22 100644 (file)
@@ -249,7 +249,7 @@ get_new:
                 */
                if (err == -EIO) {
                        cpos += 1 << (sb->s_blocksize_bits);
-                       cpos &= ~(sb->s_blocksize - 1);
+                       cpos &= ~(loff_t)(sb->s_blocksize - 1);
                }
 
                err = -EIO;