diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-03 17:37:38 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2015-12-04 10:56:29 +1100 |
commit | c75304a13906e2a91752a12ef90e31ab18467453 (patch) | |
tree | 67d66f58a284becdf5ecef5b1276dd4721f2c7dc /hw/ppc | |
parent | 4c65fed8bdf96780735dbdb92a8bd0d6b6526cc3 (diff) | |
download | hqemu-c75304a13906e2a91752a12ef90e31ab18467453.zip hqemu-c75304a13906e2a91752a12ef90e31ab18467453.tar.gz |
spapr_drc: Handle visitor errors properly
Since prop_get_fdt() is only used with QmpOutputVisitor, errors
shouldn't actually happen, so this is only a latent bug.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr_drc.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index f34bc04..4e7a1d3 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -254,6 +254,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); + Error *err = NULL; int fdt_offset_next, fdt_offset, fdt_depth; void *fdt; @@ -276,24 +277,43 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); - visit_start_struct(v, NULL, NULL, name, 0, NULL); + visit_start_struct(v, NULL, NULL, name, 0, &err); + if (err) { + error_propagate(errp, err); + return; + } break; case FDT_END_NODE: /* shouldn't ever see an FDT_END_NODE before FDT_BEGIN_NODE */ g_assert(fdt_depth > 0); - visit_end_struct(v, NULL); + visit_end_struct(v, &err); + if (err) { + error_propagate(errp, err); + return; + } fdt_depth--; break; case FDT_PROP: { int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); - visit_start_list(v, name, NULL); + visit_start_list(v, name, &err); + if (err) { + error_propagate(errp, err); + return; + } for (i = 0; i < prop_len; i++) { - visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, NULL); - + visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, &err); + if (err) { + error_propagate(errp, err); + return; + } + } + visit_end_list(v, &err); + if (err) { + error_propagate(errp, err); + return; } - visit_end_list(v, NULL); break; } default: |