[libvirt] [PATCH 4/6] conf: Refactor domain list collection critical section

Peter Krempa pkrempa at redhat.com
Mon May 11 10:37:13 UTC 2015


On Mon, May 11, 2015 at 06:29:35 -0400, John Ferlan wrote:
> 
> 
> On 04/30/2015 08:44 AM, Peter Krempa wrote:
> 
> ...
> 
> > 
> > -    if (!(dom = virGetDomain(data->conn, vm->def->name, vm->def->uuid))) {
> > -        data->error = true;
> > -        goto cleanup;
> > +
> > +int
> > +virDomainObjListCollect(virDomainObjListPtr domlist,
> > +                        virConnectPtr conn,
> > +                        virDomainObjPtr **vms,
> > +                        size_t *nvms,
> > +                        virDomainObjListACLFilter filter,
> > +                        unsigned int flags)
> > +{
> > +    struct virDomainListData data = { NULL, 0 };
> > +
> > +    virObjectLock(domlist);
> > +    if (VIR_ALLOC_N(data.vms, virHashSize(domlist->objs)) < 0) {
> 
> Coverity checker wasn't very happy with this especially if virHashSize
> returns a negative number.

False positive. virHashSize returns null only if the hash is NULL which
never happens for domlist-objs.

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150511/66fd1ae3/attachment-0001.sig>


More information about the libvir-list mailing list