From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKM5I-0005pD-89 for qemu-devel@nongnu.org; Wed, 29 Jul 2015 03:47:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKM5F-0005lw-0c for qemu-devel@nongnu.org; Wed, 29 Jul 2015 03:47:28 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:33824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKM5E-0005lm-P9 for qemu-devel@nongnu.org; Wed, 29 Jul 2015 03:47:24 -0400 Received: by wibud3 with SMTP id ud3so209105845wib.1 for ; Wed, 29 Jul 2015 00:47:24 -0700 (PDT) Sender: Paolo Bonzini References: <1438043577-28636-1-git-send-email-marcandre.lureau@redhat.com> <1438043577-28636-4-git-send-email-marcandre.lureau@redhat.com> From: Paolo Bonzini Message-ID: <55B88509.3000305@redhat.com> Date: Wed, 29 Jul 2015 09:47:21 +0200 MIME-Version: 1.0 In-Reply-To: <1438043577-28636-4-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 03/45] ivhsmem: read do not accept more than sizeof(long) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: drjones@redhat.com, cam@cs.ualberta.ca, =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , stefanha@redhat.com On 28/07/2015 02:32, Marc-André Lureau wrote: > From: Marc-André Lureau > > ivshmem_read() only reads sizeof(long) from the input buffer. Accepting > more could lead to fifo8 abort() on x86 if it's not empty. > > Signed-off-by: Marc-André Lureau > --- > hw/misc/ivshmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index cc76989..fb53b3f 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -272,7 +272,7 @@ static void ivshmem_receive(void *opaque, const uint8_t *buf, int size) > > static int ivshmem_can_receive(void * opaque) > { > - return 8; > + return sizeof(long); > } > > static void ivshmem_event(void *opaque, int event) > -- 2.4.3 I would prefer to change all longs to uint64_t, to avoid a dependency on the host long size. Even better one could have uint32_t for the id plus a flags value that for now would always be zero. Paolo