From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvXAj-0000uk-HJ for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:53:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvXAe-0006bF-Hg for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:53:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvXAe-0006bA-AM for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:53:04 -0500 Message-ID: <50F6E3B1.4020307@redhat.com> Date: Wed, 16 Jan 2013 10:30:25 -0700 From: Eric Blake MIME-Version: 1.0 References: <1358349851-20960-1-git-send-email-ehabkost@redhat.com> <1358349851-20960-9-git-send-email-ehabkost@redhat.com> In-Reply-To: <1358349851-20960-9-git-send-email-ehabkost@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2FNOFCWWRFOJHBTAKVLUT" Subject: Re: [Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Chegu Vinod , qemu-devel@nongnu.org, Anthony Liguori This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2FNOFCWWRFOJHBTAKVLUT Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/16/2013 08:24 AM, Eduardo Habkost wrote: > - Accept empty strings without aborting > - Use parse_uint*() to parse numbers > - Abort if anything except '-' or end-of-string is found after the firs= t > number. > - Check for endvalue < value >=20 > Also change the MAX_CPUMASK_BITS warning message from "A max of %d CPUs= > are supported in a guest" to "qemu: NUMA: A max of %d VCPUs are > supported". >=20 > Signed-off-by: Eduardo Habkost > --- > Cc: Eric Blake > --- > vl.c | 32 +++++++++++++++++++++++++++----- > 1 file changed, 27 insertions(+), 5 deletions(-) >=20 > =20 > - value =3D strtoull(cpus, &endptr, 10); > + /* Empty CPU range strings will be considered valid, they will sim= ply > + * not set any bit in the CPU bitmap. > + */ > + if (!*cpus) { > + return; Does the code behave correctly when there are no bits in the CPU bitmap, or do you require that at least one bit be set? > + } > + > + if (parse_uint(cpus, &value, &endptr) < 0) { > + goto error; Again, another case of accepting octal where you used to only accept binary; if the change of interpretation of 010 is intentional, it would be worth documenting in the commit message. Otherwise, it might be worth refactoring 1/8 to add a 'base' parameter to parse_uint[_full] to allow the caller to control whether they want base 0 or base 10. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2FNOFCWWRFOJHBTAKVLUT 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/ iQEcBAEBCAAGBQJQ9uOxAAoJEKeha0olJ0NqJMAH/0Hrje0uPaW3lmsKdX1B9Zjr TGchwscE4fFgi0oXc+UZr++434F+eu0XXCkSab9Z1tjgZWwDJg/afX/H5+H8ip+J Zat61ByJVYN7Hea1Uw7BPxNkVJaWUeZ/NtzX/88l+ZimnB4mKOzMiqi14WHjFn2X MIhgx4797JdiPIu8BgiK54PAnFAX5IX8/M4PvE/ndU3OoivlN8BcT2Kf/KhlhBGK v4r0D8khdMNva9Rv+N2degSW12yn2HA7N1tFvg+6vXkauOj/qPhj0x9qaLyalZy2 GENz6N36mI3tVrujR24RzZ05wMlj37NjCXGoqzwqTm6+GnT8xTzDN0T6UuqKlFU= =oCWj -----END PGP SIGNATURE----- ------enig2FNOFCWWRFOJHBTAKVLUT--