Skip to contentSkip to conversation

Btrfs: cleanup destroy_marked_extents

DISCUSSION Dan Carpenter 2 participants 2 messages May 9, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello Josef Bacik,

This is a semi-automatic email about new static checker warnings.

The patch fd8b2b611580: "Btrfs: cleanup destroy_marked_extents" from Apr 24, 2013, leads to the following Smatch complaint:

fs/btrfs/disk-io.c:3814 btrfs_destroy_marked_extents()
warn: variable dereferenced before check 'eb' (see line 3813)

fs/btrfs/disk-io.c
3812 root->leafsize);

  3813				start += eb->len;
                                         ^^^^^^^
New dereference.
  3814				if (!eb)
                                    ^^^

New check. Maybe we should be adding "root->leafsize" here? Just the check earlier would cause a forever loop.

  3815					continue;
  3816				wait_on_extent_buffer_writeback(eb);

regards,
dan carpenter

#1 lore raw
Quoted 17 lines · Dan Carpenter

Hello Josef Bacik,

This is a semi-automatic email about new static checker warnings.

The patch fd8b2b611580: "Btrfs: cleanup destroy_marked_extents" from Apr 24, 2013, leads to the following Smatch complaint:

fs/btrfs/disk-io.c:3814 btrfs_destroy_marked_extents()
warn: variable dereferenced before check 'eb' (see line 3813)

fs/btrfs/disk-io.c
3812 root->leafsize);

  3813				start += eb->len;
                                         ^^^^^^^
New dereference.
  3814				if (!eb)
                                    ^^^
Quoted 6 lines

New check. Maybe we should be adding "root->leafsize" here? Just the check earlier would cause a forever loop.

  3815					continue;
  3816				wait_on_extent_buffer_writeback(eb);

Yeah I sent a patch for it yesterday, just me being an idiot, nothing to see here,

Josef