From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tcy1r-0002lY-6X for qemu-devel@nongnu.org; Mon, 26 Nov 2012 07:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tcy1m-00070D-Ot for qemu-devel@nongnu.org; Mon, 26 Nov 2012 07:43:15 -0500 Received: from cantor2.suse.de ([195.135.220.15]:41911 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tcy1m-000707-FW for qemu-devel@nongnu.org; Mon, 26 Nov 2012 07:43:10 -0500 Message-ID: <50B363DA.5090501@suse.de> Date: Mon, 26 Nov 2012 13:43:06 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1353931812-4451-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1353931812-4451-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1.3] qapi: handle visitor->type_size() in QapiDeallocVisitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: 1079713@bugs.launchpad.net, Anthony Liguori , qemu-devel@nongnu.org, Michael Roth Am 26.11.2012 13:10, schrieb Stefan Hajnoczi: > visit_type_size() requires either visitor->type_size() or > visitor_uint64() to be implemented, otherwise a NULL function pointer i= s > invoked. >=20 > It is possible to trigger this crash as follows: >=20 > $ qemu-system-x86_64 -netdev tap,sndbuf=3D0,id=3Dnetdev0 \ > -device virtio-blk-pci,netdev=3Dnetdev0 >=20 > The 'sndbuf' option has type "size". >=20 > Signed-off-by: Stefan Hajnoczi > --- > This patch ensures that -netdev tap,sndbuf=3DX works in QEMU 1.3. Reviewed-by: Andreas F=E4rber Did you check whether any other types were unhandled? Should a comment be added somewhere along the lines of "If you add a hook here you also need to implement one there" to avoid such inconsistency for the future? Andreas >=20 > qapi/qapi-dealloc-visitor.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c > index a154523..a07b171 100644 > --- a/qapi/qapi-dealloc-visitor.c > +++ b/qapi/qapi-dealloc-visitor.c > @@ -132,6 +132,11 @@ static void qapi_dealloc_type_number(Visitor *v, d= ouble *obj, const char *name, > { > } > =20 > +static void qapi_dealloc_type_size(Visitor *v, size_t *obj, const char= *name, > + Error **errp) > +{ > +} > + > static void qapi_dealloc_type_enum(Visitor *v, int *obj, const char *s= trings[], > const char *kind, const char *name, > Error **errp) > @@ -164,6 +169,7 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void) > v->visitor.type_bool =3D qapi_dealloc_type_bool; > v->visitor.type_str =3D qapi_dealloc_type_str; > v->visitor.type_number =3D qapi_dealloc_type_number; > + v->visitor.type_size =3D qapi_dealloc_type_size; > =20 > QTAILQ_INIT(&v->stack); > =20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg