From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIlGX-0002sS-Hd for qemu-devel@nongnu.org; Thu, 21 Mar 2013 15:35:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIlGV-0001oq-4p for qemu-devel@nongnu.org; Thu, 21 Mar 2013 15:35:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIlGU-0001mC-Rb for qemu-devel@nongnu.org; Thu, 21 Mar 2013 15:35:07 -0400 Message-ID: <514B60E5.6090707@redhat.com> Date: Thu, 21 Mar 2013 13:35:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1363890878-8161-1-git-send-email-owasserm@redhat.com> <1363890878-8161-3-git-send-email-owasserm@redhat.com> In-Reply-To: <1363890878-8161-3-git-send-email-owasserm@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2LLETDDIEGWXTMDQVAFST" Subject: Re: [Qemu-devel] [PATCH v4 2/8] Add socket_writev_buffer function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Orit Wasserman Cc: pbonzini@redhat.com, quintela@redhat.com, chegu_vinod@hp.com, qemu-devel@nongnu.org, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2LLETDDIEGWXTMDQVAFST Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/21/2013 12:34 PM, Orit Wasserman wrote: > Signed-off-by: Orit Wasserman > --- > savevm.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) >=20 > diff --git a/savevm.c b/savevm.c > index 35c8d1e..6608b6e 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -39,6 +39,7 @@ > #include "qmp-commands.h" > #include "trace.h" > #include "qemu/bitops.h" > +#include "qemu/iov.h" > =20 > #define SELF_ANNOUNCE_ROUNDS 5 > =20 > @@ -171,6 +172,19 @@ static void coroutine_fn yield_until_fd_readable(i= nt fd) > qemu_coroutine_yield(); > } > =20 > +static int socket_writev_buffer(void *opaque, struct iovec *iov, int i= ovcnt) Returning int... > +{ > + QEMUFileSocket *s =3D opaque; > + ssize_t len; > + ssize_t size =3D iov_size(iov, iovcnt); > + > + len =3D iov_send(s->fd, iov, iovcnt, 0, size); > + if (len < size) { > + len =3D -socket_error(); > + } > + return len; =2E..but len is an ssize_t. If we send an iov with 2 gigabytes of data, this can wrap around to a negative int even though we send a positive amount of data. Why not make the callback be typed to return ssize_t from the beginning (affects patch 1/8)? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2LLETDDIEGWXTMDQVAFST Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRS2DlAAoJEKeha0olJ0NqfwEH/21ZX89wgMl/0KcSqkwdGaYv YCNm41O30CDPxMdsFcpeD2ANidWu5CABTBbbvQ8f2A5ADrJtf8kKT64AzFsDAZ+7 IInsJtSLbS/Q7aygM4URnYQQ4quNAuPq2WG60veM2ls+jR8BDYRiuLvuzR1cJUjM jkyI0P+K4sAs68+WaS81O+F0Yx/Vayskwr/9uaW/GHsVih02zxNq+HMWiwNoilOd uhhB/oBpUnPFLja4ZZ0BoFUFi/X868qlEDmGCou8tng1zKbzXTomdoWh//2txCwm 8jZdkNXlfmNzZpr2D4/EQZvqpaTWCIiIhG6Uhlcf2yf8Hvn73pa/40v7Nji8Opk= =La1R -----END PGP SIGNATURE----- ------enig2LLETDDIEGWXTMDQVAFST--