From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJYTy-00016G-9E for qemu-devel@nongnu.org; Wed, 13 Jan 2016 22:21:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJYTx-0007qM-9u for qemu-devel@nongnu.org; Wed, 13 Jan 2016 22:21:54 -0500 References: <1452646350-11999-1-git-send-email-famz@redhat.com> <1452646350-11999-2-git-send-email-famz@redhat.com> From: Eric Blake Message-ID: <5697144B.2040002@redhat.com> Date: Wed, 13 Jan 2016 20:21:47 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J4l1ere3heJm5ixihel5EfUiqOKpuSMHh" Subject: Re: [Qemu-devel] [PATCH v2 1/2] blockdev: Error out on negative throttling option values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --J4l1ere3heJm5ixihel5EfUiqOKpuSMHh Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/13/2016 03:17 AM, Alberto Garcia wrote: > On Wed 13 Jan 2016 01:52:29 AM CET, Fam Zheng wrote: >=20 >> The implicit casting from unsigned int to double changes negative valu= es >> into large positive numbers and accepts them. We should instead print= >> an error. >> >> Check the number range so this case is catched and reported. s/catched/caught/ >=20 > I still don't know why qemu_opt_get_number() convert silently negative > numbers into positive ones, shouldn't it just fail with an "invalid > parameter" error? Passing -1 as a synonym for ULLONG_MAX can be convenient. But rejecting it outright rather than doing wraparound wouldn't hurt libvirt too badly.= >=20 >> +#define THROTTLE_VALUE_MAX 1000000000000000L >=20 > This is larger than LONG_MAX in 32-bit systems, I don't know if you nee= d > to use LL instead. You do need LL, not for C99, but for older compilers (hello mingw). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --J4l1ere3heJm5ixihel5EfUiqOKpuSMHh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWlxRLAAoJEKeha0olJ0NqEB0H/2+3kg3zES9OqvQY2BKkyyZR ut2R6oK5xFGtzv6/PGn9wDMk1FffNIPSLIWn7qsywWGPhNux5g3dGKrRegZ+R4tN Utjnwc8CrSapd3J/SdJ+0kbg5q95P0OiOHeTJwcBHPhU1nWuFDfbrEsiooUAwBSA KpTyUVo9tbrA2FLtfkim52u/QB1KmQws/QJ1HnV8Qw65mQW81noRGKFWLl0tozdY AKsloERi92nCi3v8M7O1oiiHT+65JvtGKtRABu5kjfeuxLu9+kXHPs2RgEnLmYqu dQsTnGW0gp8hR8I/XlpLOo/QhaiL1ofzukxILjWqL+Hvy2/bpuseAb/ChfoMlSY= =CCra -----END PGP SIGNATURE----- --J4l1ere3heJm5ixihel5EfUiqOKpuSMHh--