Skip to content

Commit

Permalink
Fix leaf overflow check in btrfs_insert_empty_items
Browse files Browse the repository at this point in the history
It was incorrectly adding an extra sizeof(struct btrfs_item) and causing
false positives (oops)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 23a0786 commit f25956c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2737,8 +2737,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
nritems = btrfs_header_nritems(leaf);
data_end = leaf_data_end(root, leaf);

if (btrfs_leaf_free_space(root, leaf) <
sizeof(struct btrfs_item) + total_size) {
if (btrfs_leaf_free_space(root, leaf) < total_size) {
btrfs_print_leaf(root, leaf);
printk("not enough freespace need %u have %d\n",
total_size, btrfs_leaf_free_space(root, leaf));
Expand Down

0 comments on commit f25956c

Please sign in to comment.