Thread (4 messages) 4 messages, 3 authors, 2016-02-23

Re: [PATCH] btrfs: use proper type for failrec in extent_state

From: David Sterba <hidden>
Date: 2016-02-22 17:58:46

On Thu, Feb 11, 2016 at 01:24:13PM +0100, David Sterba wrote:
We use the private member of extent_state to store the failrec and play
pointless pointer games.

Signed-off-by: David Sterba <dsterba@suse.com>
I'm not sure why, but my gcc 5.3.1 think's that a member of failrec can
be used uninitialized:

  CC [M]  fs/btrfs/extent_io.o
fs/btrfs/extent_io.c: In function ‘clean_io_failure’:
fs/btrfs/extent_io.c:2133:4: warning: ‘failrec’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    repair_io_failure(inode, start, failrec->len,
    ^

which points to:

2126         if (state && state->start <= failrec->start &&
2127             state->end >= failrec->start + failrec->len - 1) {
2128                 num_copies = btrfs_num_copies(fs_info, failrec->logical,
2129                                               failrec->len);
2130                 if (num_copies > 1)  {
2131                         repair_io_failure(inode, start, failrec->len,
2132                                           failrec->logical, page,
2133                                           pg_offset, failrec->failed_mirror);
2134                 }
2135         }

After separating all members to local varaibles, it points to ->len. Which is
used several times in code above.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help