* [Qemu-devel] [PULL 1/3] spapr_drc: Handle visitor errors properly
2015-12-04 6:46 [Qemu-devel] [PULL 0/3] ppc-for-2.5 queue 20151204 David Gibson
@ 2015-12-04 6:46 ` David Gibson
2015-12-04 6:46 ` [Qemu-devel] [PULL 2/3] spapr_drc: Make device "spapr-dr-connector" unavailable with -device David Gibson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2015-12-04 6:46 UTC (permalink / raw)
To: peter.maydell, armbru; +Cc: thuth, agraf, qemu-devel, qemu-ppc, David Gibson
From: Markus Armbruster <armbru@redhat.com>
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>
---
hw/ppc/spapr_drc.c | 32 ++++++++++++++++++++++++++------
1 file 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:
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 3/3] spapr_drc: Change value of property "fdt" from null back to {}
2015-12-04 6:46 [Qemu-devel] [PULL 0/3] ppc-for-2.5 queue 20151204 David Gibson
2015-12-04 6:46 ` [Qemu-devel] [PULL 1/3] spapr_drc: Handle visitor errors properly David Gibson
2015-12-04 6:46 ` [Qemu-devel] [PULL 2/3] spapr_drc: Make device "spapr-dr-connector" unavailable with -device David Gibson
@ 2015-12-04 6:46 ` David Gibson
2015-12-04 10:54 ` [Qemu-devel] [PULL 0/3] ppc-for-2.5 queue 20151204 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2015-12-04 6:46 UTC (permalink / raw)
To: peter.maydell, armbru; +Cc: thuth, agraf, qemu-devel, qemu-ppc, David Gibson
From: Markus Armbruster <armbru@redhat.com>
prop_get_fdt() misuses the visitor API: when fdt is null, it doesn't
visit anything. object_property_get_qobject() happily
object_property_get_qobject(). Amazingly, the latter survives the
misuse. Turns out we've papered over it long before prop_get_fdt()
existed, in commit 1d10b44.
However, commit 6c2f9a1 changed how we paper over it, and as a side
effect changed qom-get's value from {} to null. Change it right back
by fixing the visitor misuse.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/ppc/spapr_drc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 404fb3c..8be62c3 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -259,6 +259,11 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque,
void *fdt;
if (!drc->fdt) {
+ visit_start_struct(v, NULL, NULL, name, 0, &err);
+ if (!err) {
+ visit_end_struct(v, &err);
+ }
+ error_propagate(errp, err);
return;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] ppc-for-2.5 queue 20151204
2015-12-04 6:46 [Qemu-devel] [PULL 0/3] ppc-for-2.5 queue 20151204 David Gibson
` (2 preceding siblings ...)
2015-12-04 6:46 ` [Qemu-devel] [PULL 3/3] spapr_drc: Change value of property "fdt" from null back to {} David Gibson
@ 2015-12-04 10:54 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2015-12-04 10:54 UTC (permalink / raw)
To: David Gibson
Cc: Alexander Graf, Thomas Huth, QEMU Developers, Markus Armbruster,
qemu-ppc@nongnu.org
On 4 December 2015 at 06:46, David Gibson <david@gibson.dropbear.id.au> wrote:
> The following changes since commit 4c65fed8bdf96780735dbdb92a8bd0d6b6526cc3:
>
> ui: vnc: avoid floating point exception (2015-12-03 13:34:50 +0000)
>
> are available in the git repository at:
>
> git://github.com/dgibson/qemu.git tags/ppc-for-2.5-20151204
>
> for you to fetch changes up to ab8bf1d735133df5b5847bef0b0bea496d614a5a:
>
> spapr_drc: Change value of property "fdt" from null back to {} (2015-12-04 16:50:59 +1100)
>
>
> Peter,
>
> Not sure if you need a pull req for this, or you could just merge
> Markus' patches directly, but to avoid another round trip if you would
> prefer a pull req, here is one.
Applied, thanks.
I do prefer pull requests. That's partly because they're a little
easier for me to process, but mostly because a pull is an unambigious
statement from a submaintainer that they're happy with these patches
and want me to apply them to master, in a format that I can
automatically filter out of the mass of qemu-devel emails and into
a folder where it gets my attention. I don't have anything similar
for "please apply this patch", so that kind of request is more at
risk of getting missed.
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread