[libvirt] [PATCH] snapashot: Improve logic of virDomainMomentMoveChildren

Bjoern Walk bwalk at linux.ibm.com
Fri Mar 29 06:58:49 UTC 2019


Eric Blake <eblake at redhat.com> [2019-03-28, 09:05AM -0500]:
> Even though Coverity can prove that 'last' is always set if the prior
> loop executed, gcc 8.0.1 cannot:
> 
>   CC       conf/libvirt_conf_la-virdomainmomentobjlist.lo
> ../../src/conf/virdomainmomentobjlist.c: In function 'virDomainMomentMoveChildren':
> ../../src/conf/virdomainmomentobjlist.c:178:19: error: 'last' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>          last->sibling = to->first_child;
>          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
> 
> Rewrite the loop to a form that should be easier for static analysis
> to work with.
> 
> Fixes: ced0898f86bf
> Reported-by: Bjoern Walk <bwalk at linux.ibm.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> Qualifies as a build-breaker fix, but I'd like a review before pushing.

Looks good to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 902 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190329/d37e5b2a/attachment-0001.sig>


More information about the libvir-list mailing list