From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqqRY-0004bS-Di for qemu-devel@nongnu.org; Mon, 26 Oct 2015 18:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqqRX-00024M-8n for qemu-devel@nongnu.org; Mon, 26 Oct 2015 18:40:44 -0400 References: <1445897165-4842-1-git-send-email-jsnow@redhat.com> <1445897165-4842-2-git-send-email-jsnow@redhat.com> From: Eric Blake Message-ID: <562EABDF.40906@redhat.com> Date: Mon, 26 Oct 2015 16:40:31 -0600 MIME-Version: 1.0 In-Reply-To: <1445897165-4842-2-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wqP2ixX04eWKD9OAdfltvxXmtElBk3Ue7" 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) --wqP2ixX04eWKD9OAdfltvxXmtElBk3Ue7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > 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; Pre-existing: attempting to raise signal -1 claims that -1 is non-numeric. Not the end of the world. > + } else if (sig > INT_MAX) { > + printf("signal argument '%s' is too large\n", argv[1]); > + return 0; > } Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --wqP2ixX04eWKD9OAdfltvxXmtElBk3Ue7 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/ iQEcBAEBCAAGBQJWLqvfAAoJEKeha0olJ0NqG4UH/3OfKNopGWbWzdA3fiPCR9Im Gpqvn3j51ioUpPxFtNqlhTyWiTEUYVoUrc5vEOJEHZL3vQGZ/5EJvtWBATNtRs61 i+3LwnVo8bFVhROIremgpUiZYlwzR2UbEUtJ1ica78hJgzhQHxzpGvrfz9YC6a+v kiucpF6k83txGP1LrVGhvVlBDXaLeVF0at49ayjao3omUPfM1cVWTi3nYZCXelHM UXOq6fLfIPdvJUOYDKiT3IUXtrYs7rtxpkJCL6pInsezxDhtDe6f3KTfTk5wVxEf k4GLiBAOAI31mYjlPvNa5WKL2G8u/0/ezL08NiSgVSFL3twaqkxe+YxBzaKvMoE= =WgaS -----END PGP SIGNATURE----- --wqP2ixX04eWKD9OAdfltvxXmtElBk3Ue7--