From nobody Sat May 18 21:26:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637321556; cv=none; d=zohomail.com; s=zohoarc; b=mId1NKUnQ2/Dj1DPSeOUwmMqWJKqFoOfp38xT8GLXpwHF4Mr/gYfAenuCxHGnOCDqhoEUVyRa6SgMLr8OnOHj1FgSdRWGosUQP0RGykmgS+YbaoPlmVHeYDj7BvPb9gPGkb6EcYeC3Dxh7XSF0FwsORyL9tNUG0twGYLufkHJDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637321556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=L5SPzgBXAW+dyHwMZ9KNwUhM2nBFRPRF0cO1t6WFYPs=; b=kSJKnbtg//LZchST+XsP2f95nBm/+8rQL7d/8r8zFijNgT/I94Oi8+yNWEuDkerfEb8Dspk6+8fg6XrXqdzP+dpZLUNKVWpZ4ht1KFlb4LhSB284kL4dmbWpC7K1uQCUrr4OawVyX5ogQMvfg2ukAHawHzZLkqu3kXqTUXIl9k0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1637321556637267.85861753178904; Fri, 19 Nov 2021 03:32:36 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-530-SMjdkfHmNIyCw8cJbg3HLw-1; Fri, 19 Nov 2021 06:32:32 -0500 Received: by mail-wm1-f70.google.com with SMTP id 201-20020a1c04d2000000b003335bf8075fso3943903wme.0 for ; Fri, 19 Nov 2021 03:32:32 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id v7sm2643015wrq.25.2021.11.19.03.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 03:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637321555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L5SPzgBXAW+dyHwMZ9KNwUhM2nBFRPRF0cO1t6WFYPs=; b=W2BaXpOgauJmO0RQLc656siSkD7HtFxeuqjzdm2gzNpGaMFoNiwnkt+yejsR4ZZ14LZdyj Fx7bDQq3GvROM5MHhmHNyTnse5QHwMmmeo0Zh+Psd1Qc4T4GhyNrf2VeXhSJ9SAKKaOl2I lK0oiObJPYjzGuwuhlSyEl4CWlB3cTw= X-MC-Unique: SMjdkfHmNIyCw8cJbg3HLw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=L5SPzgBXAW+dyHwMZ9KNwUhM2nBFRPRF0cO1t6WFYPs=; b=sFi02GQCym6K5U6DOBTRetCSfgr3owGCd8ymMoX16H1XRi29laLztyHFnLgqkCXEzX pRduEVKJsdfmiGRhKF7qrGLMCi2G36mknFtFl3uEt2UbGWkQod5Vdf7tdZCbmM6GES6Q enSll2vGvWS1spTMJ8BKkshdQ0CUyLXOErZvcEBf3JE6CnIM9p/ewYDMQ2mKjytgNS6Z B10tn11YZYlH43I1Ki7NysZU7gVgB7ARlqPO+mGpRHdl0U/3M05cr13UvBTYhlb8T1ow i1f/vE6YGdnGGw5ACtxusoBY6lWBTXJIyGlyyxq3YttzaHQVabRsUfNcXasP3QGWlkSj SqQg== X-Gm-Message-State: AOAM532L1YKzF2MfwafK6hH822OI20X/FlsTneikzlId2clvR4D7fUPE ZEgIjeAMHbc17nIQHu3MFU3ajNxGpzIYSWQd2ksZRtV4gtgm5gLYrnSj6d0sfX2HNBgq1XDMKnM YbwpCooyQlGuvlA== X-Received: by 2002:a7b:cf25:: with SMTP id m5mr6034644wmg.51.1637321551013; Fri, 19 Nov 2021 03:32:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7mioYjmw0idYSlrXfW284YrW4A9QiTBYpJkWt57R0crfnrJUrpaMHLS3pUriGtF3rkluTcA== X-Received: by 2002:a7b:cf25:: with SMTP id m5mr6034616wmg.51.1637321550870; Fri, 19 Nov 2021 03:32:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-6.2] qom/object: Ignore global properties with empty name Date: Fri, 19 Nov 2021 12:32:29 +0100 Message-Id: <20211119113229.350338-1-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637321558957100001 When using -global, properties might have empty name/value. This fixes this legitimate use case: $ qemu-system-x86_64 -global driver=3Disa-fdc qemu-system-x86_64: ../../devel/qemu/qapi/string-input-visitor.c:394: string_input_visitor_new: Assertion `str' failed. Aborted (core dumped) (gdb) bt #4 0x0000555555f6b8d5 in string_input_visitor_new (str=3D0x0) at qapi/st= ring-input-visitor.c:394 #5 0x0000555555dd0f8d in object_property_parse (obj=3D0x555556f33400, na= me=3D0x0, string=3D0x0, errp=3D0x7fffffffc9c8) at qom/object.c:1641 #6 0x0000555555dce131 in object_apply_global_props (obj=3D0x555556f33400= , props=3D0x555556737360, errp=3D0x555556611760 ) at qom/objec= t.c:411 #7 0x0000555555dc5ee2 in qdev_prop_set_globals (dev=3D0x555556f33400) at= hw/core/qdev-properties.c:790 #8 0x0000555555dc89e8 in device_post_init (obj=3D0x555556f33400) at hw/c= ore/qdev.c:697 #9 0x0000555555dce02b in object_post_init_with_type (obj=3D0x555556f3340= 0, ti=3D0x55555672bd20) at qom/object.c:383 #10 0x0000555555dce059 in object_post_init_with_type (obj=3D0x555556f3340= 0, ti=3D0x5555566e9090) at qom/object.c:387 #11 0x0000555555dce059 in object_post_init_with_type (obj=3D0x555556f3340= 0, ti=3D0x5555566df730) at qom/object.c:387 #12 0x0000555555dce566 in object_initialize_with_type (obj=3D0x555556f334= 00, size=3D848, type=3D0x5555566df730) at qom/object.c:519 #13 0x0000555555dcec78 in object_new_with_type (type=3D0x5555566df730) at= qom/object.c:733 #14 0x0000555555dceccf in object_new (typename=3D0x5555560fcf81 "isa-fdc"= ) at qom/object.c:748 #15 0x0000555555dc75fe in qdev_new (name=3D0x5555560fcf81 "isa-fdc") at h= w/core/qdev.c:153 #16 0x00005555559eec58 in isa_new (name=3D0x5555560fcf81 "isa-fdc") at hw= /isa/isa-bus.c:166 #17 0x0000555555bd3607 in pc_superio_init (isa_bus=3D0x5555566b42e0, crea= te_fdctrl=3Dtrue, no_vmport=3Dfalse) at hw/i386/pc.c:1026 (gdb) fr 6 #6 0x0000555555dce131 in object_apply_global_props (obj=3D0x555556f33400= , props=3D0x555556737360, errp=3D0x555556611760 ) at qom/objec= t.c:411 411 if (!object_property_parse(obj, p->property, p->value, &e= rr)) { (gdb) p *p $1 =3D {driver =3D 0x555556738250 "isa-fdc", property =3D 0x0, value =3D = 0x0, used =3D true, optional =3D false} Reported-by: Thomas Huth Resolves: https://gitlab.com/qemu-project/qemu/-/issues/604 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Darren Kenny --- qom/object.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qom/object.c b/qom/object.c index 4f0677cca9e..45fa8561df6 100644 --- a/qom/object.c +++ b/qom/object.c @@ -401,6 +401,9 @@ bool object_apply_global_props(Object *obj, const GPtrA= rray *props, GlobalProperty *p =3D g_ptr_array_index(props, i); Error *err =3D NULL; =20 + if (!p->property) { + continue; + } if (object_dynamic_cast(obj, p->driver) =3D=3D NULL) { continue; } --=20 2.31.1