Patchwork [1/2] virtio-pci: build for uninitialized return value in vq_vector_unmask

login
register
mail settings
Submitter Michael Roth
Date Jan. 14, 2013, 7:20 p.m.
Message ID <1358191213-404-2-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/211866/
State New
Headers show

Comments

Michael Roth - Jan. 14, 2013, 7:20 p.m.
Fixes the following:

/home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function
‘kvm_virtio_pci_vector_unmask’:
/home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be
used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/virtio-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Eduardo Habkost - Jan. 14, 2013, 7:35 p.m.
On Mon, Jan 14, 2013 at 01:20:12PM -0600, Michael Roth wrote:
> Fixes the following:
> 
> /home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function
> ‘kvm_virtio_pci_vector_unmask’:
> /home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be
> used uninitialized in this function [-Werror=uninitialized]
> cc1: all warnings being treated as errors
> make: *** [hw/virtio-pci.o] Error 1
> make: *** Waiting for unfinished jobs....
> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

> ---
>  hw/virtio-pci.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 0b49739..0934246 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
>      VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
>      EventNotifier *n = virtio_queue_get_guest_notifier(vq);
>      VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
> -    int ret;
> +    int ret = 0;
>  
>      if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
>          ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
> -- 
> 1.7.9.5
> 
>
Anthony Liguori - Jan. 14, 2013, 7:37 p.m.
Michael Roth <mdroth@linux.vnet.ibm.com> writes:

> Fixes the following:
>
> /home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function
> ‘kvm_virtio_pci_vector_unmask’:
> /home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be
> used uninitialized in this function [-Werror=uninitialized]
> cc1: all warnings being treated as errors
> make: *** [hw/virtio-pci.o] Error 1
> make: *** Waiting for unfinished jobs....
>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

Looks like I didn't have libaio-devel installed on my new development
box :-/

Regards,

Anthony Liguori

> ---
>  hw/virtio-pci.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 0b49739..0934246 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
>      VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
>      EventNotifier *n = virtio_queue_get_guest_notifier(vq);
>      VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
> -    int ret;
> +    int ret = 0;
>  
>      if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
>          ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
> -- 
> 1.7.9.5
Michael S. Tsirkin - Jan. 14, 2013, 7:54 p.m.
On Mon, Jan 14, 2013 at 01:37:35PM -0600, Anthony Liguori wrote:
> Michael Roth <mdroth@linux.vnet.ibm.com> writes:
> 
> > Fixes the following:
> >
> > /home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function
> > ‘kvm_virtio_pci_vector_unmask’:
> > /home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be
> > used uninitialized in this function [-Werror=uninitialized]
> > cc1: all warnings being treated as errors
> > make: *** [hw/virtio-pci.o] Error 1
> > make: *** Waiting for unfinished jobs....
> >
> > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> 
> Looks like I didn't have libaio-devel installed on my new development
> box :-/
> 
> Regards,
> 
> Anthony Liguori

Me neither. And apparently neither does the buildbot.

> > ---
> >  hw/virtio-pci.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> > index 0b49739..0934246 100644
> > --- a/hw/virtio-pci.c
> > +++ b/hw/virtio-pci.c
> > @@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
> >      VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
> >      EventNotifier *n = virtio_queue_get_guest_notifier(vq);
> >      VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
> > -    int ret;
> > +    int ret = 0;
> >  
> >      if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
> >          ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
> > -- 
> > 1.7.9.5
>

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 0b49739..0934246 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -616,7 +616,7 @@  static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
     VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
     EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    int ret;
+    int ret = 0;
 
     if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
         ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);