From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zfbos-0005bi-Er for qemu-devel@nongnu.org; Fri, 25 Sep 2015 18:50:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zfbon-0007ry-5f for qemu-devel@nongnu.org; Fri, 25 Sep 2015 18:50:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zfbom-0007ro-Tv for qemu-devel@nongnu.org; Fri, 25 Sep 2015 18:50:17 -0400 References: <1442872682-6523-1-git-send-email-eblake@redhat.com> <1442872682-6523-6-git-send-email-eblake@redhat.com> <87a8sbga01.fsf@blackfin.pond.sub.org> <56041E2A.1070509@redhat.com> <87612zbx2h.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <5605CFA2.1040504@redhat.com> Date: Fri, 25 Sep 2015 16:50:10 -0600 MIME-Version: 1.0 In-Reply-To: <87612zbx2h.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h8kmpSPho4sUXLCAfuXrlUMf10wKlBJCU" Subject: Re: [Qemu-devel] [PATCH v5 05/46] qapi: Test use of 'number' within alternates List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com, DirtY.iCE.hu@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h8kmpSPho4sUXLCAfuXrlUMf10wKlBJCU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/24/2015 10:29 AM, Markus Armbruster wrote: >>> Any particular reason for adding the initializer? >>> >>>> >>>> v =3D visitor_input_test_init(data, "42"); >>>> >>>> - visit_type_UserDefAlternate(v, &tmp, NULL, &err); >>>> - g_assert(err =3D=3D NULL); >>>> + visit_type_UserDefAlternate(v, &tmp, NULL, &error_abort); >> >> Hmm - I don't know if we have a clear contract for what happens if you= >> call visit_type_FOO on an uninitialized pointer. It may have been >> succeeding by mere luck. >=20 > I strongly suspect the "input" visitors are assignment-like: they store= > something, and don't care what value they overwrite. Let's keep that i= n > mind when we retrofit a contract. >=20 Hmm. When I delete the initializer, valgrind starts warning at a later point in my series: /visitor/input/errors: OK /visitor/input/alternate-number: =3D=3D16451=3D=3D Conditional jump or mo= ve depends on uninitialised value(s) =3D=3D16451=3D=3D at 0x14AA7E: visit_start_implicit_struct (qapi-visit= -core.c:36) =3D=3D16451=3D=3D by 0x111D80: visit_type_AltStrBool (test-qapi-visit.= c:207) =3D=3D16451=3D=3D by 0x10EC16: test_visitor_in_alternate_number (test-qmp-input-visitor.c:426) =3D=3D16451=3D=3D by 0x4EBBB92: test_case_run (gtestutils.c:2124) =3D=3D16451=3D=3D by 0x4EBBB92: g_test_run_suite_internal (gtestutils.= c:2185) =3D=3D16451=3D=3D by 0x4EBBD5A: g_test_run_suite_internal (gtestutils.= c:2196) =3D=3D16451=3D=3D by 0x4EBBD5A: g_test_run_suite_internal (gtestutils.= c:2196) =3D=3D16451=3D=3D by 0x4EBC0DA: g_test_run_suite (gtestutils.c:2249) =3D=3D16451=3D=3D by 0x4EBC110: g_test_run (gtestutils.c:1553) =3D=3D16451=3D=3D by 0x111406: main (test-qmp-input-visitor.c:901) =3D=3D16451=3D=3D Uninitialised value was created by a stack allocation =3D=3D16451=3D=3D at 0x10EBA1: test_visitor_in_alternate_number (test-qmp-input-visitor.c:413) I don't know if that means my changes are introducing the problems, or if we really DO want to require users to pass in an initial NULL pointer. I've run out of time to investigate today, but it's not turning out to be as trivial as I had hoped. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --h8kmpSPho4sUXLCAfuXrlUMf10wKlBJCU 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/ iQEcBAEBCAAGBQJWBc+iAAoJEKeha0olJ0NqV6AIAJYqeHLP9yy39bJHF52Zqgrv TURtak0Z2WNBNqg6x/F7MYdnb/UeJBpwle0Yknm7RUtkEQLDpIfPbeLJpEKlhEa7 mKF8GRBdyCmdDYo2wg5fFkkkHnPe2bAWYOWKA/Klk/mXqJzmrGAbwORt7vk2934K 7Mq47WrCi+q/aIByTJHB9KVm8UV+X9FCW0Woo7CHwlxMiM2pjLMMBb9uxcH2Ly1/ aj6qJjarCqfvaabzV4w+4o2VeYSSSlJWLQ+F3XVLT1y6XHKi0GI1Jb/2V9nHoPjO bxZDgAizFVEzsEGyLXVuRLeXQxFQsnvl+427ghqPPk4wHku0IP75wHVbjRQmmIQ= =nHBK -----END PGP SIGNATURE----- --h8kmpSPho4sUXLCAfuXrlUMf10wKlBJCU--