From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJd28-0004k0-E4 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 03:41:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJd27-0005PT-Hx for qemu-devel@nongnu.org; Mon, 27 Jul 2015 03:41:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJd27-0005PN-Ci for qemu-devel@nongnu.org; Mon, 27 Jul 2015 03:41:11 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 0760BB8132 for ; Mon, 27 Jul 2015 07:41:10 +0000 (UTC) Message-ID: <55B5E093.20703@redhat.com> Date: Mon, 27 Jul 2015 15:41:07 +0800 From: Jason Wang MIME-Version: 1.0 References: <1437979063-25159-1-git-send-email-mst@redhat.com> In-Reply-To: <1437979063-25159-1-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Amit Shah On 07/27/2015 02:37 PM, Michael S. Tsirkin wrote: > 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); Reviewed-by: Jason Wang