On Fri 13 Nov 2015 11:15:52 AM CET, Stefan Hajnoczi <[email protected]> wrote:
> blockdev.c: In function ‘blockdev_init’:
> blockdev.c:636:17: error: ‘length’ may be used uninitialized in this function 
> [-Werror=maybe-uninitialized]
>                  block_acct_add_interval(blk_get_stats(blk), length);
>                  ^
> blockdev.c:597:22: note: ‘length’ was declared here
>              unsigned length;
>                       ^

That's a false warning because length can only be uninitialized if
'error' is set.

gcc 5.2.1 does not complain here... anyway, this should fix it:

         for (entry = qlist_first(interval_list); entry;
              entry = qlist_next(entry)) {
-            unsigned length;
+            unsigned length = 0;
             switch (qobject_type(entry->value)) {

Do you want me to send a new patch, or do you prefer to apply this
change in your branch? Thanks!

Berto

Reply via email to