qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Alexander Graf <agraf@suse.de>,
	kvmarm@lists.cs.columbia.edu,
	"Mian M. Hamayun" <m.hamayun@virtualopensystems.com>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH v7 1/3] device_tree.c: Terminate the empty reservemap in create_device_tree()
Date: Thu, 12 Sep 2013 11:17:51 +0100	[thread overview]
Message-ID: <1378981073-9989-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1378981073-9989-1-git-send-email-peter.maydell@linaro.org>

Device trees created with create_device_tree() may not have any
entries in their reservemap, because the FDT API requires that the
reservemap is completed before any FDT nodes are added, and
create_device_tree() itself creates a node.  However we were not
calling fdt_finish_reservemap(), which meant that there was no
terminator in the reservemap list and whatever happened to be at the
start of the FDT data section would end up being interpreted as
reservemap entries.  Avoid this by calling fdt_finish_reservemap()
to add the terminator.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Alexander Graf <agraf@suse.de>
---
 device_tree.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/device_tree.c b/device_tree.c
index ffec99a..391da8c 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -41,6 +41,10 @@ void *create_device_tree(int *sizep)
     if (ret < 0) {
         goto fail;
     }
+    ret = fdt_finish_reservemap(fdt);
+    if (ret < 0) {
+        goto fail;
+    }
     ret = fdt_begin_node(fdt, "");
     if (ret < 0) {
         goto fail;
-- 
1.7.9.5

  reply	other threads:[~2013-09-12 10:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 10:17 [Qemu-devel] [PATCH v7 0/3] hw/arm: Add 'virt' platform Peter Maydell
2013-09-12 10:17 ` Peter Maydell [this message]
2013-09-12 10:17 ` [Qemu-devel] [PATCH v7 2/3] hw/arm/boot: Allow boards to provide an fdt blob Peter Maydell
2013-09-12 10:17 ` [Qemu-devel] [PATCH v7 3/3] hw/arm: Add 'virt' platform Peter Maydell
2013-09-12 16:29 ` [Qemu-devel] [PATCH v7 0/3] " Christoffer Dall
2013-10-15 14:21 ` Peter Maydell
     [not found]   ` <8093E19A-6522-4E72-953E-07850720ED0A@bromium.com>
2013-10-15 15:00     ` Peter Maydell
2013-10-15 15:14       ` Tom Sutcliffe
2013-10-17 14:30         ` Peter Maydell
2013-10-17 14:49           ` Tom Sutcliffe
2013-10-17 15:00             ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378981073-9989-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=m.hamayun@virtualopensystems.com \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).