From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4tRI-0004Ub-07 for qemu-devel@nongnu.org; Thu, 01 Aug 2013 10:01:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4tRC-0003a1-V3 for qemu-devel@nongnu.org; Thu, 01 Aug 2013 10:01:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4tIh-00006T-RL for qemu-devel@nongnu.org; Thu, 01 Aug 2013 09:52:20 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r71DqIlQ018720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 1 Aug 2013 09:52:18 -0400 Message-ID: <51FA6811.3090909@redhat.com> Date: Thu, 01 Aug 2013 07:52:17 -0600 From: Eric Blake MIME-Version: 1.0 References: <1375338695-670-1-git-send-email-famz@redhat.com> In-Reply-To: <1375338695-670-1-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AlioRgjgi0K760s2CSd2FQfkQtauHQxIa" Subject: Re: [Qemu-devel] [PATCH] monitor: fix parsing of big int List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Luiz Capitulino , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AlioRgjgi0K760s2CSd2FQfkQtauHQxIa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/01/2013 12:31 AM, Fam Zheng wrote: > Fix it by calling strtoll instead, which will report ERANGE as expected= =2E >=20 > (HMP) block_set_io_throttle ide0-hd0 999999999999999999 0 0 0 0 0 > (HMP) block_set_io_throttle ide0-hd0 9999999999999999999 0 0 0 0 0 > number too large > (HMP) block_set_io_throttle ide0-hd0 99999999999999999999 0 0 0 0 0= > number too large Your change causes this error message: (HMP) block_set_io_throttle ide0-hd0 -99999999999999999999 0 0 0 0 0 number too large Does the "too large" mean in magnitude (correct message) or in value (misleading message, as any negative number is smaller in value than our minimum of 0)? >=20 > Signed-off-by: Fam Zheng > --- > monitor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/monitor.c b/monitor.c > index 5dc0aa9..7bfb469 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -3286,7 +3286,7 @@ static int64_t expr_unary(Monitor *mon) > break; > default: > errno =3D 0; > - n =3D strtoull(pch, &p, 0); > + n =3D strtoll(pch, &p, 0); I'm worried that this will break callers that treat their argument as unsigned, and where the full range of unsigned input was desirable. At this point, it's probably safer to do a case-by-case analysis of all callers that use expr_unary() to decide which callers must reject negative values, instead of making the parser reject numbers that it previously accepted, thus changing the behavior of callers that treated the result as unsigned. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AlioRgjgi0K760s2CSd2FQfkQtauHQxIa 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/ iQEcBAEBCAAGBQJR+mgRAAoJEKeha0olJ0Nq/r0H/2NLQAvpc/Lw6AYIJhjYEetG wamQH8FGkixRdw0nS/+NY5mPsbb2+Gem7beyCRtjanXcCqmjg5q7TqatW5+wTMY0 SZzdNdgUDFpTTNALmOinycmFHoIkRFJM97er3TZPNSGqSp9M/zIQulOuGMJldEtq Cdh91TWHEbKoK5bR7AmONfpzTq3Sc2fGwaWfCxBsxe/GlC5kRIufa5lM+WtGmp+6 tNv6XXzKLTC2LKRAJxCMjyRdp9VF8ItphoGuloEs/QkBvpuI+0YdtRyIAe9hRsD/ dCvZjThsDnX49+ZVjFuN8ZArbzDaGouS+FCsi2tS4d+/ziFTq2hTFGO2o77kh/s= =VlYJ -----END PGP SIGNATURE----- --AlioRgjgi0K760s2CSd2FQfkQtauHQxIa--