[libvirt] [PATCH 2/6] qemu: Move disk driver name validation into disk validation callback

Peter Krempa pkrempa at redhat.com
Wed Apr 18 13:32:01 UTC 2018


On Wed, Apr 18, 2018 at 15:13:26 +0200, Ján Tomko wrote:
> On Wed, Apr 18, 2018 at 02:54:24PM +0200, Peter Krempa wrote:
> > On Wed, Apr 18, 2018 at 13:30:24 +0200, Ján Tomko wrote:
> > > On Wed, Apr 18, 2018 at 12:55:39PM +0200, Peter Krempa wrote:
> > > > There were two places where we'd check this independently. Move it to
> > > > the disk definition validation callback. This also fixes possible use of
> > > > NULL in a printf for network storage.
> > > >
> > > > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > > > ---
> > > > src/qemu/qemu_command.c | 12 ------------
> > > > src/qemu/qemu_domain.c  |  9 +++++++++
> > > > src/qemu/qemu_hotplug.c |  7 -------
> > > > 3 files changed, 9 insertions(+), 19 deletions(-)
> > 
> > [...]
> > 
> > > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > > > index 4c4a9a428d..a3431696af 100644
> > > > --- a/src/qemu/qemu_domain.c
> > > > +++ b/src/qemu/qemu_domain.c
> > > > @@ -4165,6 +4165,7 @@ static int
> > > > qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
> > > >                                 virQEMUCapsPtr qemuCaps)
> > > > {
> > > > +    const char *driverName;
> > > 
> > > Consider initializing the variable here
> > 
> > Okay, I can do that but it's kind of pointless since it's always
> > overwritten.
> > 
> 
> Initializing to virDomainDiskGetDriver(disk);

aaah, right. STREQ_NULLABLE can't be used though, since apparently it's
okay if it's left empty, at least according to other code
-------------- 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/20180418/fd5844b2/attachment-0001.sig>


More information about the libvir-list mailing list