]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: tree-checker: fix bounds check in check_inode_extref()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 8 Oct 2025 15:08:58 +0000 (18:08 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Nov 2025 13:15:23 +0000 (22:15 +0900)
commit e92c2941204de7b62e9c2deecfeb9eaefe54a22a upstream.

The parentheses for the unlikely() annotation were put in the wrong
place so it means that the condition is basically never true and the
bounds checking is skipped.

Fixes: aab9458b9f00 ("btrfs: tree-checker: add inode extref checks")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/tree-checker.c

index 986b1612d5b04acd2b6b781af3d419f5cd6eb7a9..3bb7a376bd3fc5dcfd553ced14423d53e9e02ca1 100644 (file)
@@ -1785,7 +1785,7 @@ static int check_inode_extref(struct extent_buffer *leaf,
                struct btrfs_inode_extref *extref = (struct btrfs_inode_extref *)ptr;
                u16 namelen;
 
-               if (unlikely(ptr + sizeof(*extref)) > end) {
+               if (unlikely(ptr + sizeof(*extref) > end)) {
                        inode_ref_err(leaf, slot,
                        "inode extref overflow, ptr %lu end %lu inode_extref size %zu",
                                      ptr, end, sizeof(*extref));