From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIwD-0002ij-PQ for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:22:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMIwA-00079D-JE for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:22:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIwA-000799-Bp for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:22:22 -0500 References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-11-git-send-email-eblake@redhat.com> <8760yop3c3.fsf@blackfin.pond.sub.org> <569FCD7B.5080508@redhat.com> <87egdbnwee.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56A113CC.8040407@redhat.com> Date: Thu, 21 Jan 2016 10:22:20 -0700 MIME-Version: 1.0 In-Reply-To: <87egdbnwee.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vfpmP99QrJ5NcxjFrBqnrC7b6k2S0crWa" Subject: Re: [Qemu-devel] [PATCH v9 10/37] qapi: Make all visitors supply uint64 callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vfpmP99QrJ5NcxjFrBqnrC7b6k2S0crWa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/21/2016 01:56 AM, Markus Armbruster wrote: >>> Before: nobody implements type_uint64(), and the core falls back to >>> type_int64(), casting negative values to large positive ones. With a= n >>> implementation of type_int64() that parses large positive values as >>> negative, the two casts cancel out. >>> >>> After: everybody implements type_uint64() incorrectly, by reusing >>> type_int64() code. The problem moves from visitor core to visitor >>> implementations, where we can actually fix it if we care. >>> >>> Correct? >> >> Close. opts-visitor.c already implemented type_uint64, but also has it= s >> known bugs (and Paolo has been pinged about his claim for fixes in tha= t >> file...) >=20 > Ah, yes. opts_type_uint64() doesn't reuse opts_type_int64(), but > largely duplicates it. Potentially less wrong :) >=20 >> But otherwise, yes, in this patch, we are not fixing insanity so much = as >> localizing and better documenting it. >=20 > Let me try to clarify the commit message a bit: >=20 > This patch does not address the disparity in handling large values > as negatives. It merely moves the fallback from uint64 to int64 > from the visitor core to the visitors, where the issue can actually= > be fixed, by implementing the missing type_uint64() callbacks on to= p > of the respective type_int64() callbacks, with a FIXME comment > explaining why that's wrong. Looks good. I think we're starting to rack up enough tweaks to make it worth me posting a v10 respin to fold them all in. >>>> The dealloc visitor no longer needs a type_size callback, >>>> since that now safely falls back to the type_uint64 callback. >>> >>> Did it need the callback before this patch? >> >> Not really. Should I split out the deletion of that callback as a >> separate patch? >=20 > Probably cleanest, but merely adjusting the commit message would also > work for me: >=20 > The dealloc visitor doesn't actually need a type_size() callback, > since the visitor core can safely fall back to the type_uint64() > callback. Drop it. Okay, I won't bother to split this one; the commit message tweak seems sufficient. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --vfpmP99QrJ5NcxjFrBqnrC7b6k2S0crWa 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/ iQEcBAEBCAAGBQJWoRPMAAoJEKeha0olJ0NqBOYH/j8lVfUHn9w1GxVFtZoqSUnj IyVV/o+tHjZOdVx1L61l4n5zuw8ZvL8SZcf40sLqnKb1+1FM7inO1aCIjNNLFGsP VPYN/JpWj7nP60VPio20lXWzbU/ZjMxwJ8SvFnSlWHTO44UIjfOLV+NuVb0S8TT3 D2Ezzo49zhKOSewhiHnSIjgp/xJm425ePvSbBrE5EDPWT/FlpRb7AFAlc/Jc5yNR ZMJUlTbuMks9dl101xWhsJUL2VwWoIKaxYWHGcU+yBeN51uzpnQ7wrRdiabzF64z fRCJXTOBMx1Z4Dlx19Or0gu2vTkZpO+r+/oRHDiVglmn+8PkczD6IEIcwBOuI8g= =kBZ1 -----END PGP SIGNATURE----- --vfpmP99QrJ5NcxjFrBqnrC7b6k2S0crWa--