Skip to content

Commit 3a1655f

Browse files
committed
vhost-scsi: init backend features earlier
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: [email protected] Acked-by: Paolo Bonzini <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent b49ae91 commit 3a1655f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hw/scsi/vhost-scsi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
238238
s->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
239239
s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
240240
s->dev.vq_index = 0;
241+
s->dev.backend_features = 0;
241242

242243
ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
243244
VHOST_BACKEND_TYPE_KERNEL, true);
@@ -246,7 +247,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
246247
strerror(-ret));
247248
return;
248249
}
249-
s->dev.backend_features = 0;
250250

251251
error_setg(&s->migration_blocker,
252252
"vhost-scsi does not support migration");

0 commit comments

Comments
 (0)