From nobody Thu Oct 30 15:33:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525818098602448.9425354690361; Tue, 8 May 2018 15:21:38 -0700 (PDT) Received: from localhost ([::1]:53543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAzJ-0000gR-Mo for importer@patchew.org; Tue, 08 May 2018 18:21:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAst-0002rB-BX for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAss-0001JZ-B5 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:59 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:40906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAss-0001JC-42 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:58 -0400 Received: by mail-wm0-x241.google.com with SMTP id j5-v6so24175698wme.5 for ; Tue, 08 May 2018 15:14:58 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=XdU8P3iE2P0MFK9soiU0i94HvJYFXKxVRe1v7GYUoAM=; b=WVhLtmX7DnDinGl7BJt6njQ0MkDXCgjZ1gaercBTU/fNClhCsTwlliAs1gVaz7rJDw ye/RHNPCO9ef+XTju33SGkEWGQZACCBOLvgnxPBOEpq6Zo8z3SXNOUv0Zq6f/TjCnYaC v+gVUOIVXa3x6aiEdvEwBlSrc6hoYqsPiXtJ0BpbwLsaBwJhvxtIicFk8EpwKA5dGyYD 5UNqTpAWembYbWkbn/fF7idgVlebwEkXO7nPxIev9A8pIG3eWE/9ziZ3LeROK6OobRRX 4TgBCIVSssh39ctrYv6Z2cs+t6sWPGP3bqEBx/aDQNfUxz8zz+wJ45RUrZNzXXD+v0ku hCJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=XdU8P3iE2P0MFK9soiU0i94HvJYFXKxVRe1v7GYUoAM=; b=EkF9o9+PX9eoAX9kNh/rnFvUtNZzMsqQyH0S0mle2zdAVYdlCuW7ERHmMXd//r7OnO yJU1KlqdiCabMT5AOCAmCzK78DrRe6a9rRPiDOtqKjOLhWEvnjwPr1dBZDWnWvAZnLZx 1lkQLO2YO7PAWpqtmrsWTwHMQnrfMJaYdwAoAxkYq1W+dOm5O4pR7hs6J6+DcCfet0ca E9X76BquZZlDULCqDLwfgn5F0oibZAr+IFDOMCV9G955GrMNiij7Z07pRRl6AwAHNQDC 1N2gLTfB97S5bZrN1yZh8rDejnkPknL/9ZdBegm2IUScQpVsgbl47aUpa09Y1JTevfli 59nw== X-Gm-Message-State: ALQs6tDqRtSYjb/RDKfNZaCLXvcvFqsAZMx2bDiC6wbRRAEatbAF+g8e jFpfzYCs09/VpqyKIjP2IMJ80/ak X-Google-Smtp-Source: AB8JxZrh6+n6rpEcCOSyFDjd3yHrGPnDceCS6EmjM7ivDN8vvJ6rSg7mLyWp7zzi6SRA9P4SaPIIcQ== X-Received: by 2002:a50:b6e2:: with SMTP id f31-v6mr57031242ede.23.1525817696853; Tue, 08 May 2018 15:14:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:22 +0200 Message-Id: <1525817687-34620-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 05/30] qom: allow object_get_canonical_path_component without parent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Just return NULL; any callers that cause a change in behavior would have caused an assertion failure before, so this is safe. Signed-off-by: Paolo Bonzini --- include/qom/object.h | 1 + qom/object.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 96ce81b..a0c78c7 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1302,6 +1302,7 @@ Object *object_get_internal_root(void); * * Returns: The final component in the object's canonical path. The canon= ical * path is the path within the composition tree starting from the root. + * %NULL if the object doesn't have a parent (and thus a canonical path). */ gchar *object_get_canonical_path_component(Object *obj); =20 diff --git a/qom/object.c b/qom/object.c index 76a89af..0fc9720 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1644,8 +1644,9 @@ gchar *object_get_canonical_path_component(Object *ob= j) ObjectProperty *prop =3D NULL; GHashTableIter iter; =20 - g_assert(obj); - g_assert(obj->parent !=3D NULL); + if (obj->parent =3D=3D NULL) { + return NULL; + } =20 g_hash_table_iter_init(&iter, obj->parent->properties); while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) { --=20 1.8.3.1