From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8ZlE-00049T-SM for qemu-devel@nongnu.org; Mon, 03 Sep 2012 12:44:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8Zad-0005Qv-Bg for qemu-devel@nongnu.org; Mon, 03 Sep 2012 12:36:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Zac-0005Ql-5Z for qemu-devel@nongnu.org; Mon, 03 Sep 2012 12:33:30 -0400 Date: Mon, 3 Sep 2012 13:34:12 -0300 From: Luiz Capitulino Message-ID: <20120903133412.77cc4efa@doriath.home> In-Reply-To: <504454E0.4000606@redhat.com> References: <1346484639-15141-1-git-send-email-sw@weilnetz.de> <504454E0.4000606@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qapi: Fix potential NULL pointer segfault List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Stefan Weil , qemu-devel@nongnu.org On Mon, 03 Sep 2012 08:57:36 +0200 Paolo Bonzini wrote: > Il 01/09/2012 09:30, Stefan Weil ha scritto: > > Report from smatch: > > > > qapi-visit.c:1640 visit_type_BlockdevAction(8) error: > > we previously assumed 'obj' could be null (see line 1639) > > qapi-visit.c:2432 visit_type_NetClientOptions(8) error: > > we previously assumed 'obj' could be null (see line 2431) > > > > Signed-off-by: Stefan Weil > > --- > > scripts/qapi-visit.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py > > index 2afc5c0..1a669f3 100644 > > --- a/scripts/qapi-visit.py > > +++ b/scripts/qapi-visit.py > > @@ -157,7 +157,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error ** > > if (!error_is_set(errp)) { > > visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err); > > if (!err) { > > - if (!obj || *obj) { > > + if (obj && *obj) { > > visit_type_%(name)sKind(m, &(*obj)->kind, "type", &err); > > if (!err) { > > switch ((*obj)->kind) { > > > > Reviewed-by: Paolo Bonzini Is this for 1.2? Although the fix is pretty obvious, it doesn't seem possible to trigger the segfault today and I believe we're only accepting true bug fixes at this point (ie. two days from the release).