qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 33/46] qom: Crash more nicely on object_property_get_link() f


From: Eric Blake
Subject: Re: [PATCH 33/46] qom: Crash more nicely on object_property_get_link() failure
Date: Wed, 24 Jun 2020 16:07:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 6/24/20 11:43 AM, Markus Armbruster wrote:
Pass &error_abort instead of NULL where the returned value is
dereferenced or asserted to be non-null.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---

@@ -63,8 +64,8 @@ hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, 
SysBusDevice *sbdev,
          return -1;
      }
- parent_mr = object_property_get_link(OBJECT(sbdev_mr), "container", NULL);
-
+    parent_mr = object_property_get_link(OBJECT(sbdev_mr), "container",
+                                         &error_abort);
      assert(parent_mr);

Do we still need to keep the assert?

+++ b/hw/ppc/spapr_pci_nvlink2.c
@@ -141,9 +141,10 @@ static void spapr_phb_pci_collect_nvgpu(PCIBus *bus, 
PCIDevice *pdev,
      if (tgt) {
          Error *local_err = NULL;
          SpaprPhbPciNvGpuConfig *nvgpus = opaque;
-        Object *mr_gpu = object_property_get_link(po, "nvlink2-mr[0]", NULL);
+        Object *mr_gpu = object_property_get_link(po, "nvlink2-mr[0]",
+                                                  &error_abort);
          Object *mr_npu = object_property_get_link(po, "nvlink2-atsd-mr[0]",
-                                                  NULL);
+                                                  &error_abort);
g_assert(mr_gpu || mr_npu);

Likewise.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]