Re: [PATCH v2 12/20] cpu: Align ppc64 CPU data with x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2015-08-07 at 16:45 -0400, John Ferlan wrote:
> > >  static virCPUDataPtr
> > >  ppc64DriverNodeData(virArch arch)
> > >  {
> > > -    virCPUDataPtr cpuData;
> > > +    virCPUDataPtr nodeData;
> > > +    virCPUppc64Data *data;
> > >  
> > > -    if (VIR_ALLOC(cpuData) < 0)
> > > -        return NULL;
> > > +    if (VIR_ALLOC(nodeData) < 0)
> > > +        goto error;
> > >  
> > > -    cpuData->arch = arch;
> > > +    data = nodeData->data.ppc64;
> > > +
> > > +    if (VIR_ALLOC(data) < 0)
> > > +        goto error;
> > 
> > Coverity complains that 'data' isn't free'd (or stored to be 
> > free'd)
> > anywhere from here...
> 
> if you change the code as follows, the Coverity issue goes away (as 
> does
> the follow-up patch (13) where data->pvr is allocated.  That one is 
> fine...
> 
>     if (VIR_ALLOC(nodeData->data.ppc64) < 0)
>         goto error;
>     data = nodeData->data.ppc64;
> 
> The issue is 'data' is a local, the VIR_ALLOC will overwrite the 
> initial
> setting.

Yup, that's definitely a bug. Thanks for pointing it out.

v3 is on the way :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]