qom: Crash more nicely on object_property_get_link() failure
Pass &error_abort instead of NULL where the returned value is dereferenced or asserted to be non-null. Drop a now redundant assertion. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-24-armbru@redhat.com>
This commit is contained in:
parent
90c69fb9fd
commit
552d7f49ee
|
@ -22,6 +22,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/platform-bus.h"
|
#include "hw/platform-bus.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
||||||
|
@ -63,9 +64,8 @@ hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev,
|
||||||
return -1;
|
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);
|
|
||||||
if (parent_mr != pbus_mr_obj) {
|
if (parent_mr != pbus_mr_obj) {
|
||||||
/* MMIO region is not mapped on platform bus */
|
/* MMIO region is not mapped on platform bus */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -870,7 +870,8 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = object_property_get_link(root_container, prop->name, NULL);
|
obj = object_property_get_link(root_container, prop->name,
|
||||||
|
&error_abort);
|
||||||
drc = SPAPR_DR_CONNECTOR(obj);
|
drc = SPAPR_DR_CONNECTOR(obj);
|
||||||
drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
|
drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
|
||||||
|
|
||||||
|
|
|
@ -1655,7 +1655,8 @@ static void spapr_handle_transient_dev_before_cas(SpaprMachineState *spapr)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
drc = SPAPR_DR_CONNECTOR(object_property_get_link(drc_container,
|
drc = SPAPR_DR_CONNECTOR(object_property_get_link(drc_container,
|
||||||
prop->name, NULL));
|
prop->name,
|
||||||
|
&error_abort));
|
||||||
|
|
||||||
if (spapr_drc_transient(drc)) {
|
if (spapr_drc_transient(drc)) {
|
||||||
spapr_drc_reset(drc);
|
spapr_drc_reset(drc);
|
||||||
|
|
|
@ -358,7 +358,8 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt)
|
||||||
for (i = 0; i < sphb->nvgpus->num; ++i) {
|
for (i = 0; i < sphb->nvgpus->num; ++i) {
|
||||||
SpaprPhbPciNvGpuSlot *nvslot = &sphb->nvgpus->slots[i];
|
SpaprPhbPciNvGpuSlot *nvslot = &sphb->nvgpus->slots[i];
|
||||||
Object *nv_mrobj = object_property_get_link(OBJECT(nvslot->gpdev),
|
Object *nv_mrobj = object_property_get_link(OBJECT(nvslot->gpdev),
|
||||||
"nvlink2-mr[0]", NULL);
|
"nvlink2-mr[0]",
|
||||||
|
&error_abort);
|
||||||
uint32_t associativity[] = {
|
uint32_t associativity[] = {
|
||||||
cpu_to_be32(0x4),
|
cpu_to_be32(0x4),
|
||||||
SPAPR_GPU_NUMA_ID,
|
SPAPR_GPU_NUMA_ID,
|
||||||
|
|
2
ui/vnc.c
2
ui/vnc.c
|
@ -568,7 +568,7 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
|
||||||
&info->vencrypt, &info->has_vencrypt);
|
&info->vencrypt, &info->has_vencrypt);
|
||||||
if (vd->dcl.con) {
|
if (vd->dcl.con) {
|
||||||
dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con),
|
dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con),
|
||||||
"device", NULL));
|
"device", &error_abort));
|
||||||
info->has_display = true;
|
info->has_display = true;
|
||||||
info->display = g_strdup(dev->id);
|
info->display = g_strdup(dev->id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue