From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttlny-0004aa-BA for qemu-devel@nongnu.org; Fri, 11 Jan 2013 16:06:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttlnt-0007io-KJ for qemu-devel@nongnu.org; Fri, 11 Jan 2013 16:06:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttlnt-0007ig-CG for qemu-devel@nongnu.org; Fri, 11 Jan 2013 16:06:17 -0500 Message-ID: <50F07EBD.9010109@redhat.com> Date: Fri, 11 Jan 2013 14:06:05 -0700 From: Eric Blake MIME-Version: 1.0 References: <1357928108-21066-1-git-send-email-ehabkost@redhat.com> <1357928108-21066-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1357928108-21066-4-git-send-email-ehabkost@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7DF2A8BEE2D77198772D327F" Subject: Re: [Qemu-devel] [libvirt] [PATCH 03/10] vl.c: Isolate code specific to "-numa node" option type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: libvir-list@redhat.com, Chegu Vinod , qemu-devel@nongnu.org, Anthony Liguori This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7DF2A8BEE2D77198772D327F Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/11/2013 11:15 AM, Eduardo Habkost wrote: > Extract the code that's specific for the "node" -numa option type (the > only one, today) to a separate function. >=20 > The extracted code will eventually become a function specific for a > "numa-node" config section, independent from the numa_add() code. > + if (get_param_value(option, 128, "nodeid", optarg) =3D=3D 0) { > + nodenr =3D nb_numa_nodes; > + } else { > + nodenr =3D strtoull(option, NULL, 10); > } strtoull() needs additional error checking after the fact, to make sure I didn't pass an empty string, trailing garbage, or so many digits I triggered overflow. > + if (get_param_value(option, 128, "cpus", optarg) !=3D 0) { > + value =3D strtoull(option, &endptr, 10); > + if (*endptr =3D=3D '-') { > + endvalue =3D strtoull(endptr+1, &endptr, 10); > } else { > - nodenr =3D strtoull(option, NULL, 10); > + endvalue =3D value; > } More uses of strtoull() that aren't guarding against all possible errors.= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig7DF2A8BEE2D77198772D327F 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 undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ8H69AAoJEKeha0olJ0NqjXkH/RpY6f6D46twazaSvNXkHlnJ dBUvauZe3jq1Nix3IhMMwxvxKZZwn2+WLgb4zok0nR5ubGGALwSmRN98gAzUTYCU ga9N2k8/gwEsGJwomlg8L6iYirau7NTqkzWuEYKfwcVp8PzruvZwkx+gQ9IVKI1g TCcNv/8/nn93l5JrMdjzs9h6HFG1O0RCa2FCrQZRhWrQMd0nnMwPfxQSCCd8mweG fPE/NKQJZ5Fb6+u2v8YxFzPSxjjKxZF1XYj9bk3o3EnAV8XuiuyMtjCnmJlbS0Ss faOG/bJF5foAx00dhoQ3BNapPXxeD25Eo1Upt6+Z16tAVeqbo7OvhUJxzgfK8K8= =VdO6 -----END PGP SIGNATURE----- --------------enig7DF2A8BEE2D77198772D327F--