[{"id":3682994,"web_url":"http://patchwork.ozlabs.org/comment/3682994/","msgid":"<d48730e4-2034-4245-a671-9d2dbd72b1a3@linaro.org>","list_archive_url":null,"date":"2026-04-27T21:00:32","subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/people/85046/","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"content":"On 27/4/26 21:42, Marc-André Lureau wrote:\n> When called on an unrealized i440FX host bridge (e.g. from\n> qmp_qom_list_properties), h->bus is NULL since the root bus is only\n> created during realize. Guard against this in both\n> pci_hole64_start and pci_hole64_end getters, reporting an error.\n> \n> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> ---\n>   hw/pci-host/i440fx.c | 15 +++++++++++++--\n>   1 file changed, 13 insertions(+), 2 deletions(-)\n> \n> diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c\n> index e7d638b296c..6952094510d 100644\n> --- a/hw/pci-host/i440fx.c\n> +++ b/hw/pci-host/i440fx.c\n> @@ -189,8 +189,14 @@ static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,\n>                                                   const char *name,\n>                                                   void *opaque, Error **errp)\n>   {\n> -    uint64_t hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);\n> +    PCIHostState *h = PCI_HOST_BRIDGE(obj);\n> +    uint64_t hole64_start;\n>   \n> +    if (!h->bus) {\n> +        error_setg(errp, \"bus not realized\");\n\n\"PCI host bridge not realized\"?\n\nBut calling a getter at this point is a programming error IMHO.\n\n> +        return;\n> +    }\n> +    hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);\n>       visit_type_uint64(v, name, &hole64_start, errp);\n>   }","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=XXj2Ga0J;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4GFv1w5tz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:01:37 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHT4V-0008W1-G5; Mon, 27 Apr 2026 17:01:01 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wHT4H-0008Vb-LW\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:00:39 -0400","from mail-wm1-x329.google.com ([2a00:1450:4864:20::329])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wHT4F-0003F0-Tq\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:00:37 -0400","by mail-wm1-x329.google.com with SMTP id\n 5b1f17b1804b1-4891e86fabeso117949425e9.1\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 14:00:35 -0700 (PDT)","from [192.168.69.210] (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a775f56fcsm3613645e9.25.2026.04.27.14.00.32\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Mon, 27 Apr 2026 14:00:33 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777323634; x=1777928434; darn=nongnu.org;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :from:to:cc:subject:date:message-id:reply-to;\n bh=DYOX651bc3RSeFdNZ47ZeEcG4O1z6jjFeOzs3eJ6CHM=;\n b=XXj2Ga0JSHE6GPrCKeYt+E5BbuMsp0P3VjS7A/gYLFtM4G4geVXbDBo2waG/K88xsc\n qlMhW+4kVI1nXyuZwUA/PXkZykTUG+4WhGpkueyin3DX3yISGxfIclYQ4Ft5min4fU17\n 2TJpCxo6kRDPEzM7TO8k8bXEN+A7fjtADwJyfwoknj6lRnfCr24gsL81H1H/0vHBDGVI\n 6wmxiMHprx+CkcN6s74Do0C4vxWgrWxoAIS3JBuiKzO6oXCyGHvqSZQfOdfehYiyw2F8\n zvm4qWO9hzt3hZYRnMPm+f+yArtLvJCjxSBSL2jhJ4Fl8NkEIK9iASFkzaxLt8z/9pG3\n CB2Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777323634; x=1777928434;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=DYOX651bc3RSeFdNZ47ZeEcG4O1z6jjFeOzs3eJ6CHM=;\n b=Tkt5jON5H2IJOmXQKGXPPiSdRd7dgf8Af3+VOXTApdNB7ePZf+lO/9lbjF4dDflCdi\n P4SRqYM/GXpFnJ/MbcJicHL/f7v0zthhs/yamFf9+gajXh96DJTqGP/b7mBQqOSEXkFG\n XNOrbu/4lf3MdnyoHtib7drn8z09ikhAcqDrUEbBNK1xJArjkaEuRGj2fpL2mtivA40R\n NuUcFgryP8gePx038YFHMSDZfX13YMGNzAFsmRNQ0t5a08eqKS6oQZ4Kgg9iyh3Iks1y\n tLi9T6dvgdHBSrGLrqqparTpA83zrmQ5EKDyq/a+zkmPAf0IqvoZRQyCc9Dl1E/F4sTg\n EZ1A==","X-Forwarded-Encrypted":"i=1;\n AFNElJ+tVhw9zqqrA7w7nUuVYvCxq91XGF2DsosRbt4Ew5NDUNvIHdsWWnQSQqiq0DaxaIqZ+203aDgdZpjx@nongnu.org","X-Gm-Message-State":"AOJu0YyhcoIwV+VSDJvxGu4ET8YcNKTIdkkN1KhQguQn1oYLF9AA6qTF\n uWYY/wtJc2SplEk1QaLwf86WfEbVgA1ReKwwgF94zcbd3Yk8MgU0Ua2tKEJ9pQLUgMc=","X-Gm-Gg":"AeBDievhFM9mSiFp53LhglgGWdiiGEa1E6lUa4Odz/3qI/OkpPyKuzgMwx1fyIBLG2O\n 9oxGxzMZyShz1g1mT/zVdQB3elwxYBa2REC74Fls5II5z9Fgqp1A44r7yVWjr9OpMg0ntJN9EZ7\n p/Z+MUeiUxI/+hiDBQuGT5thdbJgiEB0vW2fsV5PjfyGiP6UxHahrL7/iJVCBZaEVwrOzON6Suy\n 1W85wJByhe5hVH14ysGpNei3a6j6TTrdVWetm7wpaWVAb80ya9pG8ctvgQotQ+rm+E8e7CjcCWf\n SJ0PfucO5AB5Q6OsjaqzYgqifyYHNJWb+IqcgdkLm7Tb9a93zbp3h+CgpZksb1LXKNDY2icRdli\n ELrM1QHRN5oqUz3qxN8n63eA2PZEUsyoHLcPpS/QzAD19Lysey2BoBdmUTsGwIFjuz1FbjOL6JM\n SoNvCtsqYyKJRGtqDeFD8p2jebo/WKr8nK2h4GUxgOzJS37JI7HTG7L6BZ3u5lATsllxAt7izr8\n Mi8","X-Received":"by 2002:a05:600d:10:b0:488:90ac:8f71 with SMTP id\n 5b1f17b1804b1-48a77aedaf1mr3031585e9.5.1777323633894;\n Mon, 27 Apr 2026 14:00:33 -0700 (PDT)","Message-ID":"<d48730e4-2034-4245-a671-9d2dbd72b1a3@linaro.org>","Date":"Mon, 27 Apr 2026 23:00:32 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","Content-Language":"en-US","To":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n qemu-devel@nongnu.org","Cc":"armbru@redhat.com, \"Michael S. Tsirkin\" <mst@redhat.com>","References":"<20260427-qom-tests-v1-0-c413f3605311@redhat.com>\n <20260427-qom-tests-v1-4-c413f3605311@redhat.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","In-Reply-To":"<20260427-qom-tests-v1-4-c413f3605311@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::329;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3683138,"web_url":"http://patchwork.ozlabs.org/comment/3683138/","msgid":"<CAJ+F1C+ginfPqr3K4yYpnhC++SDt6Z0YBH92aTexiMHZpsX6dg@mail.gmail.com>","list_archive_url":null,"date":"2026-04-28T06:10:19","subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","submitter":{"id":66774,"url":"http://patchwork.ozlabs.org/api/people/66774/","name":"Marc-André Lureau","email":"marcandre.lureau@redhat.com"},"content":"Hi\n\nOn Tue, Apr 28, 2026 at 1:01 AM Philippe Mathieu-Daudé\n<philmd@linaro.org> wrote:\n>\n> On 27/4/26 21:42, Marc-André Lureau wrote:\n> > When called on an unrealized i440FX host bridge (e.g. from\n> > qmp_qom_list_properties), h->bus is NULL since the root bus is only\n> > created during realize. Guard against this in both\n> > pci_hole64_start and pci_hole64_end getters, reporting an error.\n> >\n> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> > ---\n> >   hw/pci-host/i440fx.c | 15 +++++++++++++--\n> >   1 file changed, 13 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c\n> > index e7d638b296c..6952094510d 100644\n> > --- a/hw/pci-host/i440fx.c\n> > +++ b/hw/pci-host/i440fx.c\n> > @@ -189,8 +189,14 @@ static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,\n> >                                                   const char *name,\n> >                                                   void *opaque, Error **errp)\n> >   {\n> > -    uint64_t hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);\n> > +    PCIHostState *h = PCI_HOST_BRIDGE(obj);\n> > +    uint64_t hole64_start;\n> >\n> > +    if (!h->bus) {\n> > +        error_setg(errp, \"bus not realized\");\n>\n> \"PCI host bridge not realized\"?\n\nOk\n\n>\n> But calling a getter at this point is a programming error IMHO.\n>\n\nWe don't have a way to prevent calling getters when objects are just\ninstantiated but not yet in some \"clean\" state. Since this can be\ntriggered at run-time by QMP, we better return an error than doing\nassert() or crash.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=ESkcF4KJ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4VST01Zzz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 16:11:36 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHbfQ-0003La-Iw; Tue, 28 Apr 2026 02:11:32 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@gmail.com>)\n id 1wHbeV-0002f0-9K\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 02:10:37 -0400","from mail-dy1-x1329.google.com ([2607:f8b0:4864:20::1329])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@gmail.com>)\n id 1wHbeT-0008Fh-9m\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 02:10:34 -0400","by mail-dy1-x1329.google.com with SMTP id\n 5a478bee46e88-2ed0a45e970so480737eec.1\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 23:10:32 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1777356631; cv=none;\n d=google.com; s=arc-20240605;\n b=S7TS6M6BsZNm5SgUuWTflHqm7edWO0qHGmepHHNgi9mtTu3pXfMIqiP3jd6SssSy3G\n hEOe5us9FuwzTs5w3hCEwRyO9P2I6K3zXgR8ooe25CWmXcLiBN7lOHb9sCUDa/A+EYHj\n HLCsBNqw23URn19r7yz++AUUmiKZBxvi/aSQt8VXsOH2dXqrBHAgqukrpXDtGzYyBUdz\n WYagXQ2HeT+SbUHKJoKb2v2OWw9PRHJennm4Y/km7GSq/7TfIol3d4nqBvyLD5N0w6Kz\n 9fMW8+vghimREjBno9oD5es8BaaXnD+xaeB4r2Nlu+wQzex2ns6+Ua7/paNciZNiIfVN\n mluA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=8KCctdcuvyCf9r9u2hgYkHdY7gN0NsREHb4IcWcPcuo=;\n fh=JqQGORTJgH2aWZpUHKn5bzbF0Tsf7s+opzR8R+EYOmI=;\n b=JU39riEHtgDZaoOJloZUnDPv9/nYuy27GTz8jw19Oj+kf6152DphsPzksrqrNHsBmc\n fV2zxLLnFU1dyPeMQhGVvvOwjSLTtawRZytESRDx4ZT0Bj3FrDZbgivasqf5InPqZeAM\n fI655YhRw8vyPq0wNDt7qxfQgnDSKoKbL9qx8By5dMHD2mblpXocovNZszeWsWaWv+b/\n uK4AfsZVDvfVtj4mnLiF2qekUXqdjPZUxNf3cHMAUdFz+9NK7UUBMqf/7NmQKBPX8Q+1\n R3g9fNLNSSflM34XD9BVEqF+QzPbmDp+5GrIBMyQMt36pBzE18/FKejPmroIdYYPg52y\n VEqw==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1777356631; x=1777961431; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=8KCctdcuvyCf9r9u2hgYkHdY7gN0NsREHb4IcWcPcuo=;\n b=ESkcF4KJOfNt75bFiiAVNsTiooUZWwdEN4lWU9nDYtCltWqHOQ3DYYx2RGCRH9Kvep\n ZpuIElZaA7Krl8aJdHW02ex7kyeaqJkC1YNpA5k4Qt8dUL+pWN+8oR7cDjrHPi1PRcVo\n Kavy7pebw3+ZZZ4pK3PBnmcypXNuo5L/NggIN0mdfq6QnLxnd6460nTB+ztD0F/h98NV\n me/XaiJFkh39f/nMIBXOl3r3HqNKeJ6ZVK44oyfr8Hd6kT34glzvjRLMfQkbnTSRVtI6\n 1ZDJ75gRqd5woV2j23gBNlA6SeXDaPvqHLGTWGeo2G0uRgNHgR/Vv8S6n4ofpOXzOaWF\n EpfA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777356631; x=1777961431;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=8KCctdcuvyCf9r9u2hgYkHdY7gN0NsREHb4IcWcPcuo=;\n b=hgyoGq4QJRsaAJvOqyrmCEfATM/ie/Q4/oyLkXPKxy4IEW/LD/wUplWlYyGOaa1JVj\n tYQrSgzd9ZsOcdWDqcFGYseiJxtxacj8QBLsudCPo4Abul6cHdlt1J0d54G7x/x/g83s\n VYeKpw7VHtk2loFeM9TXmMFs3lv5znbZYCad7+XtDjoq22ER2H1kdr3ggYVMhX/ETBVj\n 3ZtXCUn73GwMUV7cAN6+eftZH8AsbSZ/vBsuNCUV63QvjDeHeGrMwpAKjqh3QYiyhjRa\n QsZI+yczc+W16FGlBlBuSKv6f0kkWL8HHimYoOMnsnhlEv9SD0dF6zouAetDrbl62B7m\n LOwQ==","X-Gm-Message-State":"AOJu0YyycmLDbKgjBTYNOU8OO8TX+Yfgq0fi2nXv7ZQJKRXK6Mj5IHB3\n Rw7L1G71UjKCW01/7hjFMVfKCODCEESSAT572KnjCT8g08gfvoD9VTSpS1lI1UQ8hDSX8x055vM\n Ta27ave4TNH7r8wn57TOulCPmPiOyTJw=","X-Gm-Gg":"AeBDievv3u4agK+hhqRzlzodjao+3S60i2lONkwp3sdXgXw+Cb/reMyQ1TNAqICpZ0b\n VIFVtkEYsaDFOIDBLWZPPrl8g8Fd+TZBXI+eCrfpqSh0X/GTQMV3JF/xNGbTM51inEvnGZcEm5I\n X6aNUO5qYCrM+JdyAhlh3I2tMFLUBNVOuOVYpU/n7JvemnS7ANLw0NIWdBoDD8jligBAFaEXY2z\n Cpk72pnswnAphsQuhQo73APULWPO7ab2j1X7UokZgrF+mayMe2OYkE6GmsF9F1BZel5BTJA88oL\n 7HagRJxkxCRhkIyA8CoBSQydzp7ByTUNVm8ISd2F9BjMHEc7BTaUGWxZO1wFoA==","X-Received":"by 2002:a05:7300:bb8a:b0:2c1:6cfd:73ee with SMTP id\n 5a478bee46e88-2ed0a0a99d1mr747519eec.24.1777356631313; Mon, 27 Apr 2026\n 23:10:31 -0700 (PDT)","MIME-Version":"1.0","References":"<20260427-qom-tests-v1-0-c413f3605311@redhat.com>\n <20260427-qom-tests-v1-4-c413f3605311@redhat.com>\n <d48730e4-2034-4245-a671-9d2dbd72b1a3@linaro.org>","In-Reply-To":"<d48730e4-2034-4245-a671-9d2dbd72b1a3@linaro.org>","From":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>","Date":"Tue, 28 Apr 2026 10:10:19 +0400","X-Gm-Features":"AVHnY4JjyIt1RQJvuFHktf_L9pE7s51ZXxqXSjJco_W-OnjFoisQUM-7xKjgFzI","Message-ID":"\n <CAJ+F1C+ginfPqr3K4yYpnhC++SDt6Z0YBH92aTexiMHZpsX6dg@mail.gmail.com>","Subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","Cc":"qemu-devel@nongnu.org, armbru@redhat.com,\n \"Michael S. Tsirkin\" <mst@redhat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::1329;\n envelope-from=marcandre.lureau@gmail.com; helo=mail-dy1-x1329.google.com","X-Spam_score_int":"-16","X-Spam_score":"-1.7","X-Spam_bar":"-","X-Spam_report":"(-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,\n FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=no autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3683140,"web_url":"http://patchwork.ozlabs.org/comment/3683140/","msgid":"<8e86fe74-4b31-40e5-baf7-88ec7fd399a9@linaro.org>","list_archive_url":null,"date":"2026-04-28T06:14:46","subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/people/85046/","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"content":"On 28/4/26 08:10, Marc-André Lureau wrote:\n> Hi\n> \n> On Tue, Apr 28, 2026 at 1:01 AM Philippe Mathieu-Daudé\n> <philmd@linaro.org> wrote:\n>>\n>> On 27/4/26 21:42, Marc-André Lureau wrote:\n>>> When called on an unrealized i440FX host bridge (e.g. from\n>>> qmp_qom_list_properties), h->bus is NULL since the root bus is only\n>>> created during realize. Guard against this in both\n>>> pci_hole64_start and pci_hole64_end getters, reporting an error.\n>>>\n>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n>>> ---\n>>>    hw/pci-host/i440fx.c | 15 +++++++++++++--\n>>>    1 file changed, 13 insertions(+), 2 deletions(-)\n>>>\n>>> diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c\n>>> index e7d638b296c..6952094510d 100644\n>>> --- a/hw/pci-host/i440fx.c\n>>> +++ b/hw/pci-host/i440fx.c\n>>> @@ -189,8 +189,14 @@ static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,\n>>>                                                    const char *name,\n>>>                                                    void *opaque, Error **errp)\n>>>    {\n>>> -    uint64_t hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);\n>>> +    PCIHostState *h = PCI_HOST_BRIDGE(obj);\n>>> +    uint64_t hole64_start;\n>>>\n>>> +    if (!h->bus) {\n>>> +        error_setg(errp, \"bus not realized\");\n>>\n>> \"PCI host bridge not realized\"?\n> \n> Ok\n> \n>>\n>> But calling a getter at this point is a programming error IMHO.\n>>\n> \n> We don't have a way to prevent calling getters when objects are just\n> instantiated but not yet in some \"clean\" state. Since this can be\n> triggered at run-time by QMP, we better return an error than doing\n> assert() or crash.\n\nYeah I know, thus no objection, but still I'm wondering if this is\na good design. Maybe running introspection tests should be restricted\nto a particular QEMU mode, like x-pre-config?","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=my4+R2oF;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4VXk0HVLz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 16:15:16 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHbif-0005sp-Or; Tue, 28 Apr 2026 02:14:53 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wHbie-0005sM-GT\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 02:14:52 -0400","from mail-wm1-x330.google.com ([2a00:1450:4864:20::330])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wHbic-0000gv-F9\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 02:14:52 -0400","by mail-wm1-x330.google.com with SMTP id\n 5b1f17b1804b1-48909558b3aso109959295e9.0\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 23:14:49 -0700 (PDT)","from [192.168.69.210] (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a77aab1b4sm27180145e9.0.2026.04.27.23.14.47\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Mon, 27 Apr 2026 23:14:47 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777356889; x=1777961689; darn=nongnu.org;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :from:to:cc:subject:date:message-id:reply-to;\n bh=1d8TNqz2NHJG5W/9arvrmncK1DAev/rLBR9mufXqyrQ=;\n b=my4+R2oFHamuuevOrPO3yyjwsFJ2wzcp6l2xvxoDLrDzVYKYN4jKQUFSXD8xXf7V4M\n OGf9HYq6nD92OGKdy/x36BiDYKXHP+4cCl7YI+gmXJLrn9MpGgr0kc6Rekmr4mHord+a\n papqKzvufdLEtm4s2NK4RRj2mnazPRpKZgSSbFcFQn2eh0kIkZ0jOBYZsGI5uMK0M/eS\n 9eyKyHEzCcbftsq9AVLkg3w2mqDYMYF/uirc4VXZ411/H5mrHQPY9aWFVuhTgVssgtdB\n 6qVbGq6fNuUF2q0PlmXmR6yOdFxG0hIuQkn/H8HkezlbdW2BwKsSCwD4nXqhX3tya3fR\n q4Dw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777356889; x=1777961689;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=1d8TNqz2NHJG5W/9arvrmncK1DAev/rLBR9mufXqyrQ=;\n b=fRigyfM7R9IPWeLK5na82OapwlJZwz+vyrLThUEnIK9tHa/mUF5vxryje+l3U0asbc\n ywWOhAfs6C93DFC4Cg5tEOFOXOXUeIV1zFgnjNHlaoweic+p7tc0gS7GnUjDfqZVBLBA\n lillDl0N8pCq8ZUh4RYToIDBcfXmRgCPSsinN7nGYNp3pC4abToIekLiNQgncVi759B1\n Suiv5GNiGaDCJ3gZdXFlwptfjLAFrJeM4HxvID3VEAaChzM4ufxcG0Jpcr0JdrNvdel9\n MSCpYDJgDQK7dGc5Q/Sw5Yf4m0zteHlO7fGvDDEC7CpjxufYtQmuBAlsB38DTQfBVwEU\n 1dvg==","X-Gm-Message-State":"AOJu0YwTI12Knwkae0vg0lfDMlcR4eW3qOci/cXFIYbLf1xeP/iGRYXU\n yikW5GBrOciiDKfN9E49dkHQR6owcB3W5paBvwD4mi9E89qpKqja0sSqBe5ZqT63sqY=","X-Gm-Gg":"AeBDiesRBaa5f+18u+d/rjh4+nqKwh7CC3BnhZ3XkQFdfcRP0Anj/kkN8mRpM1n4B7o\n i20FvytyDKr+jwa2hocI4U6ywU3qtgXtyY/wBzPPgjUFLfygdEWcZJcmyCjlys6oF6DDO8PKbrB\n PVQGsFOo/PZ6p3CqT2f8JHAbfoZ2OG3jkMpox83fxaqD4+Jr8h2/vhzphQukY8Bk2IgwUhftdDd\n BLwEOcYefj5/WLgCkCBYxjm+0i2VGqOHw9rf1MOuVQdHb679qeGNyGKaDm6pkATRWpOMxsycOkm\n g1tC6iJD4w7Q3ako+5g8C+OOsIFkrjdB7mmSEmYTR3/Cjdp9IoNqQYQsERwOUHdyJkh+Ip1UrCr\n KFX8e2HMeydj1QGZ54c9fccWUC4oMSMyKP+h73HFPJhOF8r9XMl8v4PAQ6LiWqd++/ERyTAocve\n chHs89Cp53EfyLwpIo+NC2IqbKM6mhJO6xTS5lvvkwbTVLREkRUsV8i2YtbVES78Vm7jDhfx9ic\n jQG","X-Received":"by 2002:a05:600c:3b15:b0:487:1108:48af with SMTP id\n 5b1f17b1804b1-48a77ae5412mr26976425e9.4.1777356888561;\n Mon, 27 Apr 2026 23:14:48 -0700 (PDT)","Message-ID":"<8e86fe74-4b31-40e5-baf7-88ec7fd399a9@linaro.org>","Date":"Tue, 28 Apr 2026 08:14:46 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64\n getters","Content-Language":"en-US","To":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>","Cc":"qemu-devel@nongnu.org, armbru@redhat.com,\n \"Michael S. Tsirkin\" <mst@redhat.com>","References":"<20260427-qom-tests-v1-0-c413f3605311@redhat.com>\n <20260427-qom-tests-v1-4-c413f3605311@redhat.com>\n <d48730e4-2034-4245-a671-9d2dbd72b1a3@linaro.org>\n <CAJ+F1C+ginfPqr3K4yYpnhC++SDt6Z0YBH92aTexiMHZpsX6dg@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","In-Reply-To":"\n <CAJ+F1C+ginfPqr3K4yYpnhC++SDt6Z0YBH92aTexiMHZpsX6dg@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::330;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]