Skip to content

Commit

Permalink
vhost-scsi: init backend features earlier
Browse files Browse the repository at this point in the history
As vhost core can use backend_features during init, clear it earlier to
avoid using uninitialized memory.
This use would be harmless since vhost scsi ignores the result
anyway, but initializing earlier will help prevent valgrind errors,
and make scsi and net behave similarly.

Cc: qemu-stable@nongnu.org
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
mstsirkin committed Sep 3, 2014
1 parent b49ae91 commit 3a1655f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/scsi/vhost-scsi.c
Expand Up @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit 3a1655f

Please sign in to comment.