From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqqbv-0004Um-Rj for qemu-devel@nongnu.org; Mon, 26 Oct 2015 18:51:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zqqbu-0008Sx-Ur for qemu-devel@nongnu.org; Mon, 26 Oct 2015 18:51:27 -0400 References: <1445897165-4842-1-git-send-email-jsnow@redhat.com> <1445897165-4842-2-git-send-email-jsnow@redhat.com> <562EABDF.40906@redhat.com> From: Eric Blake Message-ID: <562EAE68.3090409@redhat.com> Date: Mon, 26 Oct 2015 16:51:20 -0600 MIME-Version: 1.0 In-Reply-To: <562EABDF.40906@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GiVrIB4HlfQiGpgN2cFrodU6MiEtA5rCk" Subject: Re: [Qemu-devel] [PATCH 1/3] qemu-io: fix cvtnum lval types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GiVrIB4HlfQiGpgN2cFrodU6MiEtA5rCk Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/26/2015 04:40 PM, Eric Blake wrote: > On 10/26/2015 04:06 PM, John Snow wrote: >> cvtnum() returns int64_t: we should not be storing this >> result inside of an int. >> >> In a few cases, we need an extra sprinkling of error handling >> where we expect to pass this number on towards a function that >> expects something smaller than int64_t. >> >> Signed-off-by: John Snow >> --- >> qemu-io-cmds.c | 30 ++++++++++++++++-------------- >> 1 file changed, 16 insertions(+), 14 deletions(-) >> >=20 >> @@ -2191,10 +2190,13 @@ static const cmdinfo_t sigraise_cmd =3D { >> =20 >> static int sigraise_f(BlockBackend *blk, int argc, char **argv) >> { >> - int sig =3D cvtnum(argv[1]); >> + int64_t sig =3D cvtnum(argv[1]); >> if (sig < 0) { >> printf("non-numeric signal number argument -- %s\n", argv[1])= ; >> return 0; >=20 > Pre-existing: attempting to raise signal -1 claims that -1 is > non-numeric. Not the end of the world. I stand corrected; cvtnum() returns -ERANGE if the user attempted to parse the string "-1" (that is, negative user input is not permitted, so we always have a sane errno value). [must be time for me to quit and eat some dinner...] >=20 > Reviewed-by: Eric Blake > And of course this still stands. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GiVrIB4HlfQiGpgN2cFrodU6MiEtA5rCk 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/ iQEcBAEBCAAGBQJWLq5oAAoJEKeha0olJ0NqAN8H/2R2w3H5IOIscXxIQWqlbT3d sWaMc/C1JMLxGaExstQkCJRU/1L/75JvKnAS9XlIXgiUHkia3689nE0aTuwYYqfC tjX+uAkRcZRC6vPxI38uRduJbYajIm1wyQJnKHzX/Agywy0sdv+i0aNMgkJzmiAw jvl6CxdTp/DbsH3xoRievoKrlOY3PQmMsWPjbFBVa/1u5BFon1aH9mhDDXjU2OnL t9AhB6IJ8mmejqzj5CI4uILiLI7E7L3i0tbFiicKY+dIhbOyJCvwlx93yTxMPWk+ X4LNYG1Tob5u54EQ/9RmU2ZTdhg9pL0+yaRytcy65R3Vh9xeGYuT3NfZ8nHjfPk= =TJZI -----END PGP SIGNATURE----- --GiVrIB4HlfQiGpgN2cFrodU6MiEtA5rCk--