qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier
@ 2014-09-03  9:02 Michael S. Tsirkin
  2014-09-03  9:08 ` Paolo Bonzini
  2014-09-03  9:15 ` Jason Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03  9:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Jason Wang, qemu-stable

As vhost core uses backend_features during init,
clear it earlier to avoid using uninitialized
memory.
This is harmless since vhost scsi ignores the result
anyway, but it avoids valgrind errors.

Cc: qemu-stable@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/scsi/vhost-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index ddfe76a..7146e0e 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -238,6 +238,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
     s->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
     s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
     s->dev.vq_index = 0;
+    s->dev.backend_features = 0;
 
     ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
                          VHOST_BACKEND_TYPE_KERNEL, true);
@@ -246,7 +247,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
                    strerror(-ret));
         return;
     }
-    s->dev.backend_features = 0;
 
     error_setg(&s->migration_blocker,
             "vhost-scsi does not support migration");
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier
  2014-09-03  9:02 [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier Michael S. Tsirkin
@ 2014-09-03  9:08 ` Paolo Bonzini
  2014-09-03  9:15   ` Michael S. Tsirkin
  2014-09-03  9:15 ` Jason Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2014-09-03  9:08 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Jason Wang, qemu-stable

Il 03/09/2014 11:02, Michael S. Tsirkin ha scritto:
> As vhost core uses backend_features during init,
> clear it earlier to avoid using uninitialized
> memory.
> This is harmless since vhost scsi ignores the result
> anyway, but it avoids valgrind errors.
> 
> Cc: qemu-stable@nongnu.org
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/scsi/vhost-scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index ddfe76a..7146e0e 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -238,6 +238,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
>      s->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
>      s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
>      s->dev.vq_index = 0;
> +    s->dev.backend_features = 0;
>  
>      ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
>                           VHOST_BACKEND_TYPE_KERNEL, true);
> @@ -246,7 +247,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
>                     strerror(-ret));
>          return;
>      }
> -    s->dev.backend_features = 0;
>  
>      error_setg(&s->migration_blocker,
>              "vhost-scsi does not support migration");
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

want to keep it in your treee?

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier
  2014-09-03  9:08 ` Paolo Bonzini
@ 2014-09-03  9:15   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03  9:15 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Jason Wang, qemu-devel, qemu-stable

On Wed, Sep 03, 2014 at 11:08:00AM +0200, Paolo Bonzini wrote:
> Il 03/09/2014 11:02, Michael S. Tsirkin ha scritto:
> > As vhost core uses backend_features during init,
> > clear it earlier to avoid using uninitialized
> > memory.
> > This is harmless since vhost scsi ignores the result
> > anyway, but it avoids valgrind errors.
> > 
> > Cc: qemu-stable@nongnu.org
> > Cc: Jason Wang <jasowang@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  hw/scsi/vhost-scsi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> > index ddfe76a..7146e0e 100644
> > --- a/hw/scsi/vhost-scsi.c
> > +++ b/hw/scsi/vhost-scsi.c
> > @@ -238,6 +238,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
> >      s->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
> >      s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
> >      s->dev.vq_index = 0;
> > +    s->dev.backend_features = 0;
> >  
> >      ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
> >                           VHOST_BACKEND_TYPE_KERNEL, true);
> > @@ -246,7 +247,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
> >                     strerror(-ret));
> >          return;
> >      }
> > -    s->dev.backend_features = 0;
> >  
> >      error_setg(&s->migration_blocker,
> >              "vhost-scsi does not support migration");
> > 
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> want to keep it in your treee?
> 
> Paolo

Yes please.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier
  2014-09-03  9:02 [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier Michael S. Tsirkin
  2014-09-03  9:08 ` Paolo Bonzini
@ 2014-09-03  9:15 ` Jason Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2014-09-03  9:15 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Paolo Bonzini, qemu-stable

On 09/03/2014 05:02 PM, Michael S. Tsirkin wrote:
> As vhost core uses backend_features during init,
> clear it earlier to avoid using uninitialized
> memory.
> This is harmless since vhost scsi ignores the result
> anyway, but it avoids valgrind errors.
>
> Cc: qemu-stable@nongnu.org
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/scsi/vhost-scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index ddfe76a..7146e0e 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -238,6 +238,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
>      s->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
>      s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
>      s->dev.vq_index = 0;
> +    s->dev.backend_features = 0;
>  
>      ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
>                           VHOST_BACKEND_TYPE_KERNEL, true);
> @@ -246,7 +247,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
>                     strerror(-ret));
>          return;
>      }
> -    s->dev.backend_features = 0;
>  
>      error_setg(&s->migration_blocker,
>              "vhost-scsi does not support migration");

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-03  9:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03  9:02 [Qemu-devel] [PATCH] vhost-scsi: init backend features earlier Michael S. Tsirkin
2014-09-03  9:08 ` Paolo Bonzini
2014-09-03  9:15   ` Michael S. Tsirkin
2014-09-03  9:15 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).