* [Qemu-devel] [PATCH qemu] spapr: Initialize reserved areas list in FDT in H_CAS handler
@ 2018-04-05 2:07 Alexey Kardashevskiy
2018-04-05 2:23 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2018-04-05 2:07 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson
At the moment the device tree produced by the H_CAS handler has no
reserved map initialized at all which is not correct as at least one
empty record is required to be present as a marker of the end.
This does not cause problems now as the only consumer is SLOF which
does not look at the reserved map area.
However when DTC's "Improve libfdt's memory safety" changeset hits
the QEMU upstream, there will be errors reported and crashes observed.
This fixes the problem by adding an empty entry to the reserved map,
just like create_device_tree() does already.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
hw/ppc/spapr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2c0be8c..a81570e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -865,6 +865,7 @@ int spapr_h_cas_compose_response(sPAPRMachineState *spapr,
/* Create skeleton */
fdt_skel = g_malloc0(size);
_FDT((fdt_create(fdt_skel, size)));
+ _FDT((fdt_finish_reservemap(fdt_skel)));
_FDT((fdt_begin_node(fdt_skel, "")));
_FDT((fdt_end_node(fdt_skel)));
_FDT((fdt_finish(fdt_skel)));
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH qemu] spapr: Initialize reserved areas list in FDT in H_CAS handler
2018-04-05 2:07 [Qemu-devel] [PATCH qemu] spapr: Initialize reserved areas list in FDT in H_CAS handler Alexey Kardashevskiy
@ 2018-04-05 2:23 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2018-04-05 2:23 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]
On Thu, Apr 05, 2018 at 12:07:38PM +1000, Alexey Kardashevskiy wrote:
> At the moment the device tree produced by the H_CAS handler has no
> reserved map initialized at all which is not correct as at least one
> empty record is required to be present as a marker of the end.
> This does not cause problems now as the only consumer is SLOF which
> does not look at the reserved map area.
>
> However when DTC's "Improve libfdt's memory safety" changeset hits
> the QEMU upstream, there will be errors reported and crashes observed.
>
> This fixes the problem by adding an empty entry to the reserved map,
> just like create_device_tree() does already.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Applied to ppc-for-2.12, thanks.
> ---
> hw/ppc/spapr.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 2c0be8c..a81570e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -865,6 +865,7 @@ int spapr_h_cas_compose_response(sPAPRMachineState *spapr,
> /* Create skeleton */
> fdt_skel = g_malloc0(size);
> _FDT((fdt_create(fdt_skel, size)));
> + _FDT((fdt_finish_reservemap(fdt_skel)));
> _FDT((fdt_begin_node(fdt_skel, "")));
> _FDT((fdt_end_node(fdt_skel)));
> _FDT((fdt_finish(fdt_skel)));
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-05 2:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 2:07 [Qemu-devel] [PATCH qemu] spapr: Initialize reserved areas list in FDT in H_CAS handler Alexey Kardashevskiy
2018-04-05 2:23 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).