From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJc2t-0001I4-48 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 02:37:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJc2p-0001wQ-3Q for qemu-devel@nongnu.org; Mon, 27 Jul 2015 02:37:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJc2o-0001wM-UN for qemu-devel@nongnu.org; Mon, 27 Jul 2015 02:37:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 057AC8C1CA for ; Mon, 27 Jul 2015 06:37:50 +0000 (UTC) Date: Mon, 27 Jul 2015 09:37:47 +0300 From: "Michael S. Tsirkin" Message-ID: <1437979063-25159-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah Don't assume a specific layout for control messages. Required by virtio 1. Signed-off-by: Michael S. Tsirkin --- hw/char/virtio-serial-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 78c73e5..16de50f 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, buf, len); virtqueue_push(vq, &elem, len); virtio_notify(VIRTIO_DEVICE(vser), vq); -- MST