btrfs-progs: check: fix compile warnings in del_file_extent_hole
authorDavid Sterba <dsterba@suse.cz>
Thu, 23 Apr 2015 15:28:30 +0000 (17:28 +0200)
committerDavid Sterba <dsterba@suse.cz>
Fri, 24 Apr 2015 13:42:05 +0000 (15:42 +0200)
make[1]: Nothing to be done for `all'.
cmds-check.c: In function ‘del_file_extent_hole’:
cmds-check.c:289:26: warning: ‘prev.start’ may be used uninitialized in this function
cmds-check.c:289:26: warning: ‘prev.len’ may be used uninitialized in this function
cmds-check.c:290:26: warning: ‘next.start’ may be used uninitialized in this function
cmds-check.c:290:26: warning: ‘next.len’ may be used uninitialized in this function

Reported-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-check.c

index 7eb8c214c430f72f90e50dcd4420d3a10967b26d..60ef48e391825d9b80e892e46108423db1fce541 100644 (file)
@@ -286,8 +286,10 @@ static int del_file_extent_hole(struct rb_root *holes,
 {
        struct file_extent_hole *hole;
        struct file_extent_hole tmp;
-       struct file_extent_hole prev;
-       struct file_extent_hole next;
+       u64 prev_start = 0;
+       u64 prev_len = 0;
+       u64 next_start = 0;
+       u64 next_len = 0;
        struct rb_node *node;
        int have_prev = 0;
        int have_next = 0;
@@ -307,24 +309,24 @@ static int del_file_extent_hole(struct rb_root *holes,
         * split(s) if they exists.
         */
        if (start > hole->start) {
-               prev.start = hole->start;
-               prev.len = start - hole->start;
+               prev_start = hole->start;
+               prev_len = start - hole->start;
                have_prev = 1;
        }
        if (hole->start + hole->len > start + len) {
-               next.start = start + len;
-               next.len = hole->start + hole->len - start - len;
+               next_start = start + len;
+               next_len = hole->start + hole->len - start - len;
                have_next = 1;
        }
        rb_erase(node, holes);
        free(hole);
        if (have_prev) {
-               ret = add_file_extent_hole(holes, prev.start, prev.len);
+               ret = add_file_extent_hole(holes, prev_start, prev_len);
                if (ret < 0)
                        return ret;
        }
        if (have_next) {
-               ret = add_file_extent_hole(holes, next.start, next.len);
+               ret = add_file_extent_hole(holes, next_start, next_len);
                if (ret < 0)
                        return ret;
        }