From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmOqh-0007qs-VZ for qemu-devel@nongnu.org; Wed, 14 Oct 2015 12:24:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmOqe-0006A1-O5 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 12:24:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmOqe-00069o-GY for qemu-devel@nongnu.org; Wed, 14 Oct 2015 12:24:16 -0400 References: <1444673985-24978-1-git-send-email-armbru@redhat.com> <1444673985-24978-17-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <561E81AF.7000302@redhat.com> Date: Wed, 14 Oct 2015 10:24:15 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FNjC5dPljPmFPA79BsF4q2PsHi1eSXgi3" Subject: Re: [Qemu-devel] [PULL v2 16/20] qapi: Consistent generated code: prefer common indentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Markus Armbruster Cc: QEMU This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FNjC5dPljPmFPA79BsF4q2PsHi1eSXgi3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/14/2015 10:01 AM, Marc-Andr=C3=A9 Lureau wrote: > Hi, >=20 > This patch introduces a regression: >=20 > $ x86_64-softmmu/qemu-system-x86_64 -netdev ? >=20 > Program received signal SIGSEGV, Segmentation fault. > 0x0000555555a0bc0f in visit_type_NetClientOptions (v=3D0x5555564e19e0, > obj=3D0x555556510438, name=3D0x555555af7041 "opts", errp=3D0x7fffffffd4= 50) > at qapi-visit.c:6906 > 6906 visit_end_union(v, !!(*obj)->data, &err); > (gdb) print *obj > $1 =3D (NetClientOptions *) 0x0 visit_end_union() is pointless (it is a no-op). I plan on properly deleting visit_begin_union/visit_end_union later in my series. But in the meantime, I see the source of the problem: >> @@ -264,16 +264,18 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)= s **obj, const char *name, Error >> if (err) { >> goto out; >> } >> - if (*obj) { >> + if (!*obj) { >> + goto out_obj; >> + } >> ''', >> c_name=3Dc_name(name), name=3Dname) >> ret +=3D mcgen(''' >> - default: >> - abort(); >> - } >> -out_obj: >> - error_propagate(errp, err); >> - err =3D NULL; >> - visit_end_union(v, !!(*obj)->data, &err); >> - error_propagate(errp, err); >> - err =3D NULL; >> + default: >> + abort(); >> } >> +out_obj: >> + error_propagate(errp, err); >> + err =3D NULL; >> + visit_end_union(v, !!(*obj)->data, &err); The call to visit_end_union() used to be conditional on whether *obj was non-NULL. So I'll post the quick and obvious fix. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FNjC5dPljPmFPA79BsF4q2PsHi1eSXgi3 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/ iQEcBAEBCAAGBQJWHoGvAAoJEKeha0olJ0Nqs2cH/idm3XlVbEYWcwSVafFFr0jQ 7BUGUY/yraxxgvWbZcvikXFiRxxg4AwYwbVoxye1/nopRiBjabzdaprSd8IYsYvd LZ0pIxH2f3ANPHi9mGouaQFBxLttclcKRhuX57h1wxLyqLY5BAmDbPax/T6uFrV0 Pi1BtAr7dSRu3eQokqA/3YthGq1AZT37QtzTcLMTOlg9TpJ27ZnbJyWmJ4G+yS9+ cn6zxcdv4XmsUu0g3UlsbWbdeNVoJ8zpSEaRKatG+QvsTaxe1OgYnD3Y6aZ41Tfv fjALIexjSvfVxzPewuOBL9PHMf/532l7Uu2WFC9gHEwXMKoYzXdlrgO7DCSeK80= =xGWN -----END PGP SIGNATURE----- --FNjC5dPljPmFPA79BsF4q2PsHi1eSXgi3--