From nobody Sat May 18 20:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1637324958; cv=none; d=zohomail.com; s=zohoarc; b=mcypv1Cf3sfhS7qctg2pmAOdW1wKdlDZVlb1uHkkE5v0Q7IyOKmdAOpTKwcqHUW5flwkqfPneS3PBjRg/J0VaQpRT02tORhqaUNtdZ0HN0JpdJTzzrOzX/iGg50PAGtvVcMuRSq835Kisw7IuPHc/vzPFntp+5Gja8xLY5HLBqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637324958; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=E+YM+uFqQtRebrslkx7MGj6jXY4YEZwnEuDUwanLYdw=; b=OJ9PJV6EaaDK3J7n09a3S5mK1v11qQqswhDzfKNyRayz2OgfB3u9a38mlYOrhb/X6WylfMdxAb/q1ia27PamIK4bpNs7t4dw0BSwwwJ2/FGhj9g4Y6Kmeebg24ir2HA2rJTB/bnwvjVn+9KCEN1g2N8nOUwEyyjo3wiA41D/ZeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1637324958013903.2807062812989; Fri, 19 Nov 2021 04:29:18 -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-547-0oT_K8DmOaKuEBfboicZuQ-1; Fri, 19 Nov 2021 07:29:15 -0500 Received: by mail-wm1-f70.google.com with SMTP id 145-20020a1c0197000000b0032efc3eb9bcso5847643wmb.0 for ; Fri, 19 Nov 2021 04:29:14 -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 o4sm13954331wmq.31.2021.11.19.04.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 04:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637324956; 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=E+YM+uFqQtRebrslkx7MGj6jXY4YEZwnEuDUwanLYdw=; b=ViVLWIujDCchYzJuQyEh7ANVqozQBBoPCxchXzxXvJXYF1f8BX+VFgEln1arPGk616ysJe 0NUIdmJrLKS6xFA6uaRBKg3pHv10MNrztlseufTJAWq7c6MhHetNSz4lKiJyeJP7h/4yMB pqA2FdtyoYBBfhSp+noRl0XE21WLCks= X-MC-Unique: 0oT_K8DmOaKuEBfboicZuQ-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=E+YM+uFqQtRebrslkx7MGj6jXY4YEZwnEuDUwanLYdw=; b=ZQKSxMPtCJSZ/ZjXdZcVLmbifnjGpdK5dfXYtI4y+XNyltOU+zXM9ZynlrT9bxb0XP 0ZRZS2ugrPg3VUwUZ8NEi1SdrBsoTql6o54fF84QpTMLf52uae5Vy3S/Hj0JMz9HGzBr lRBDL2OzpgjaHqs6JOVk/2EnCAVEyswsseZZqLJbbsH/zFVxHJRlvqEB3rmykr4pA2jz 4w8B1ttNO68cSFCXxJxRgyc48A0qF4fn/ar/AKWc+tTQOWKXry31PVbmGEBlPqEcipPY ESsIfxV8IV7xsJr+7biKPHgE1onWEDoq/onKLWfVt7ykib5oKqMYcBRflgGU4U63a3Pe 9ECw== X-Gm-Message-State: AOAM531y7Lgk/Oet3BeFQls0EmRIzD+CxQ/cfQo1H9henvNkEVkF7HXx WWyr5w6Xwi4imW1LL5S5RXntRSdSCNtZiJg3XNoT+MJPFn+nep4vu266ipzCRoY7vHFXqPUYXoI NZNyUi1fozAmi/w== X-Received: by 2002:a05:600c:22d9:: with SMTP id 25mr6255338wmg.71.1637324953762; Fri, 19 Nov 2021 04:29:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwf9V+gplc8AYEK15dOpOBnxlqpvEyWMRzCDOwvyoFqDb6qhIc9GN/PHNgzMpAjjCvzMRVwrw== X-Received: by 2002:a05:600c:22d9:: with SMTP id 25mr6255298wmg.71.1637324953445; Fri, 19 Nov 2021 04:29:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-6.2 v2] qom/object: Ignore global properties with empty name Date: Fri, 19 Nov 2021 13:29:11 +0100 Message-Id: <20211119122911.365036-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: 1637324959402100001 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 0x5f6b8d5 in string_input_visitor_new (str=3D0x0) at qapi/string-inpu= t-visitor.c:394 #5 0x5dd0f8d in object_property_parse (obj=3D0x6f33400, name=3D0x0, stri= ng=3D0x0, errp=3D0x7ffc9c8) at qom/object.c:1641 #6 0x5dce131 in object_apply_global_props (obj=3D0x6f33400, props=3D0x67= 37360, errp=3D0x6611760 ) at qom/object.c:411 #7 0x5dc5ee2 in qdev_prop_set_globals (dev=3D0x6f33400) at hw/core/qdev-= properties.c:790 #8 0x5dc89e8 in device_post_init (obj=3D0x6f33400) at hw/core/qdev.c:697 #9 0x5dce02b in object_post_init_with_type (obj=3D0x6f33400, ti=3D0x672b= d20) at qom/object.c:383 #10 0x5dce059 in object_post_init_with_type (obj=3D0x6f33400, ti=3D0x66e9= 090) at qom/object.c:387 #11 0x5dce059 in object_post_init_with_type (obj=3D0x6f33400, ti=3D0x66df= 730) at qom/object.c:387 #12 0x5dce566 in object_initialize_with_type (obj=3D0x6f33400, size=3D848= , type=3D0x66df730) at qom/object.c:519 #13 0x5dcec78 in object_new_with_type (type=3D0x66df730) at qom/object.c:= 733 #14 0x5dceccf in object_new (typename=3D0x60fcf81 "isa-fdc") at qom/objec= t.c:748 #15 0x5dc75fe in qdev_new (name=3D0x60fcf81 "isa-fdc") at hw/core/qdev.c:= 153 #16 0x59eec58 in isa_new (name=3D0x60fcf81 "isa-fdc") at hw/isa/isa-bus.c= :166 #17 0x5bd3607 in pc_superio_init (isa_bus=3D0x66b42e0, create_fdctrl=3Dtr= ue, no_vmport=3Dfalse) at hw/i386/pc.c:1026 (gdb) fr 6 #6 0x5dce131 in object_apply_global_props (obj=3D0x6f33400, props=3D0x67= 37360, errp=3D0x6611760 ) at qom/object.c:411 411 if (!object_property_parse(obj, p->property, p->value, &e= rr)) { (gdb) p *p $1 =3D {driver =3D 0x6738250 "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 --- v2: s/55555555// for readability --- 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