[libvirt] [PATCH 3/4] qemu: add missing break in qemuDomainDeviceCalculatePCIConnectFlags

Daniel P. Berrange berrange at redhat.com
Thu Feb 23 09:41:16 UTC 2017


On Wed, Feb 22, 2017 at 02:52:08PM -0600, Eric Blake wrote:
> On 02/22/2017 11:52 AM, Daniel P. Berrange wrote:
> > One of the conditions in qemuDomainDeviceCalculatePCIConnectFlags
> > was missing a break that could result it in falling through to
> > an incorrect codepath.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> >  src/qemu/qemu_domain_address.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
> > index 5b75044..27ca010 100644
> > --- a/src/qemu/qemu_domain_address.c
> > +++ b/src/qemu/qemu_domain_address.c
> > @@ -553,6 +553,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
> >              return pciFlags;
> >          }
> >      }
> > +        break;
> 
> Indentation looks weird.  I guess its because we have an extra {} scope
> for allowing declaration of variables?  Would hoisting the declaration
> (not initialization) of
> 
>     case VIR_DOMAIN_DEVICE_CONTROLLER: {
>         virDomainControllerDefPtr cont = dev->data.controller;
> 
> allow us to get rid of the weird {}?

Yes, though this style is not that unusual - we've got it in a number
of other places in libvirt already where we want to isolate the
variable declaration, so I think this is ok as is.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list