Received: from eggs.gnu.org ([2001:4830:134:3::10]:51829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X42ck-00010P-0k for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:42:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X42cd-0002KZ-Ox for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:42:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X42cd-0002KJ-Gg for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:41:55 -0400 Date: Mon, 7 Jul 2014 08:41:48 +0200 From: Igor Mammedov Message-ID: <20140707084148.702be087@nial.usersys.redhat.com> In-Reply-To: <1404416735-22371-3-git-send-email-ehabkost@redhat.com> References: <1404416735-22371-1-git-send-email-ehabkost@redhat.com> <1404416735-22371-3-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Peter Maydell , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Don Slutz , Markus Armbruster , Paolo Bonzini , Andreas =?ISO-8859-1?B?RuRyYmVy?= On Thu, 3 Jul 2014 16:45:35 -0300 Eduardo Habkost wrote: > This fixes the following crash: > > $ qemu-system-x86_64 -global container.xxx=y > hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device > Aborted (core dumped) > > New behavior will be to just warn, just like when non-existing clas > names are used: > > $ qemu-system-x86_64 -global container.xxx=y > qemu-system-x86_64: Warning: "-global container.xxx=y" not used > > Signed-off-by: Eduardo Habkost > --- > hw/core/qdev-properties-system.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c > index 8e140af..ae0900f 100644 > --- a/hw/core/qdev-properties-system.c > +++ b/hw/core/qdev-properties-system.c > @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque) > g->driver = qemu_opt_get(opts, "driver"); > g->property = qemu_opt_get(opts, "property"); > g->value = qemu_opt_get(opts, "value"); > - oc = object_class_by_name(g->driver); > + oc = object_class_dynamic_cast(object_class_by_name(g->driver), > + TYPE_DEVICE); > if (oc) { > DeviceClass *dc = DEVICE_CLASS(oc); > Reviewed-by: Igor Mammedov