[libvirt] [PATCH] qemu: hotplug: Don't access srcPriv when it's not allocated

Peter Krempa pkrempa at redhat.com
Wed Jul 4 07:12:08 UTC 2018


On Tue, Jul 03, 2018 at 17:05:31 +0200, Marc Hartmayer wrote:
> On Tue, Jul 03, 2018 at 04:22 PM +0200, Peter Krempa <pkrempa at redhat.com> wrote:
> > On Tue, Jul 03, 2018 at 09:34:56 -0400, John Ferlan wrote:
> >> Feels like we've done this before...
> >>
> >> 97202988 <sigh> and 6050affb7f
> >
> > Specifically the former commit was not good enough to cover this case
> > despite touching this code.
> 
> Would it make sense to always allocate the
> qemuDomainStorageSourcePrivate struct? We’d be wasting some memory, but
> at the same time the code would be easier to read and less prone to
> error. e.g. qemuDomainDeviceDiskDefPostParseRestoreSecAlias would be
> simpler.
> 
> For the privateData of virConnect, virDomainVsockDef, virDisk,
> virDomainVcpu… it’s implemented this way.
> 
> Anyway: Reviewed-by: Marc Hartmayer <mhartmay at linux.ibm.com> and thanks
> for fixing it!

virStorageSource is not allocated using a helper so this would require
refactoring all allocations and passing in of the private data structure
which contains the callback to allocate the private data. I was thinking
about it but did not find fixing it compelling enough to do it myself.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180704/9c78faa5/attachment-0001.sig>


More information about the libvir-list mailing list