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

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

 



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@xxxxxxxxxx>
> > ---
> > 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.

> 
> >     virStorageSourcePtr n;
> > 
> >     if (disk->src->shared && !disk->src->readonly) {
> > @@ -4183,6 +4184,14 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
> >         }
> >     }
> > 
> > +    if ((driverName = virDomainDiskGetDriver(disk)) &&
> > +        STRNEQ(driverName, "qemu")) {
> 
> and/or using STRNEQ_NULLABLE here.

Umm why? It's guarded by checking of the assignment.

Attachment: signature.asc
Description: PGP signature

--
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]

  Powered by Linux