From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxHzy-0001pN-K4 for qemu-devel@nongnu.org; Wed, 18 Jun 2014 11:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxHzs-0005dz-Rx for qemu-devel@nongnu.org; Wed, 18 Jun 2014 11:42:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxHzs-0005d4-K0 for qemu-devel@nongnu.org; Wed, 18 Jun 2014 11:42:00 -0400 Message-ID: <53A1B344.3080205@redhat.com> Date: Wed, 18 Jun 2014 09:41:56 -0600 From: Eric Blake MIME-Version: 1.0 References: <1403105798-25418-1-git-send-email-mst@redhat.com> In-Reply-To: <1403105798-25418-1-git-send-email-mst@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dw5D3OSApVbBJ6RNi0wV5eRa8jwOFI83w" Subject: Re: [Qemu-devel] [PATCH] qapi: fix input visitor bugs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Michael Roth , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dw5D3OSApVbBJ6RNi0wV5eRa8jwOFI83w Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/18/2014 09:36 AM, Michael S. Tsirkin wrote: > Remove dead code. Reset errno to 0 before each strtoull call, as the > man page requires. >=20 > Reported-by: Eric Blake > Signed-off-by: Michael S. Tsirkin > --- > qapi/string-input-visitor.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c > index 72722e6..d8a8db0 100644 > --- a/qapi/string-input-visitor.c > +++ b/qapi/string-input-visitor.c > @@ -48,11 +48,10 @@ static void parse_str(StringInputVisitor *siv, Erro= r **errp) > return; > } > =20 > - errno =3D 0; > do { > + errno =3D 0; > start =3D strtoll(str, &endptr, 0); > - if (errno =3D=3D 0 && endptr > str && INT64_MIN <=3D start && > - start <=3D INT64_MAX) { > + if (errno =3D=3D 0 && endptr > str) { Based on this conditional... > if (*endptr =3D=3D '\0') { > cur =3D g_malloc0(sizeof(*cur)); > cur->begin =3D start; > @@ -63,9 +62,9 @@ static void parse_str(StringInputVisitor *siv, Error = **errp) > str =3D NULL; > } else if (*endptr =3D=3D '-') { > str =3D endptr + 1; > + errno =3D 0; =2E..this assignment to errno is dead code (we already know it is 0). Bu= t I'd rather leave it in for robustness sake (any change to intermediate code may change the situation where we are no longer assured of the current value of errno at this point). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --dw5D3OSApVbBJ6RNi0wV5eRa8jwOFI83w 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTobNEAAoJEKeha0olJ0NqQN8H/iwSj1OXiPSCW82tvG2SJuhs mUG+DxbPw2z1ozLYTQryqx5sBleZDUiyDUlvGRaewM9diLYGdCgDHy4/fAqb71KA sMOVfPZZGpIleWuctC7JW4GBaLDdZQmdgY73uYsHkrAEcCK8770DZ23HTm3e1TY2 XPO5j7A1EHayKuhB6sCqYBIvtm5oGA6TY90AWa7lJNiDljixz3LuZgUdgFHc1PJ/ lB84gC0cg788hfK7WL0p91GetVn/0+pVmvZA5w8ZeDBsv/YHl132T9jCD5Y+pH/M u95+XsVA5lrww4e0NrJ1ab12JjID+NCQOWI4AN5uRodsV/sf/ksYya34igoEcOU= =alAd -----END PGP SIGNATURE----- --dw5D3OSApVbBJ6RNi0wV5eRa8jwOFI83w--