aboutsummaryrefslogtreecommitdiff
path: root/hw/char/virtio-serial-bus.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-07-23 17:52:02 +0300
committerMichael S. Tsirkin <mst@redhat.com>2015-07-27 11:24:48 +0300
commit7882080388be5088e72c425b02223c02e6cb4295 (patch)
treee8be52b316ebbdf732b83cf2d5f7a587efbf78b1 /hw/char/virtio-serial-bus.c
parent5f456073aa9ba54e421aa82dd38e4d40d0a0af85 (diff)
virtio-serial: fix ANY_LAYOUT
Don't assume a specific layout for control messages. Required by virtio 1. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/char/virtio-serial-bus.c')
-rw-r--r--hw/char/virtio-serial-bus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 78c73e5abe..929e49c671 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
return 0;
}
- memcpy(elem.in_sg[0].iov_base, buf, len);
+ /* TODO: detect a buffer that's too short, set NEEDS_RESET */
+ iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);
virtqueue_push(vq, &elem, len);
virtio_notify(VIRTIO_DEVICE(vser), vq);