* fdt: fix for add_subnode()
@ 2013-12-04 15:28 Leif Lindholm
2013-12-05 9:11 ` Francesco Lavra
0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2013-12-04 15:28 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
The current fdt support fails to update the size of the dt_struct after
adding a new node. Attached is the suggested fix.
/
Leif
[-- Attachment #2: 0001-grub-core-lib-fdt.c-correctly-update-size_dt_struct-.patch --]
[-- Type: text/x-diff, Size: 1605 bytes --]
From d424d2fe0581c1f036aae9a8b0371d65d007ef61 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Wed, 4 Dec 2013 12:59:21 +0000
Subject: [PATCH] grub-core/lib/fdt.c: correctly update size_dt_struct in
add_subnode()
---
ChangeLog | 4 ++++
grub-core/lib/fdt.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index ccd9e8e..1a96695 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-04 Leif Lindholm <leif.lindholm@linaro.org>
+
+ * grub-core/kern/fdt.c: Update struct size when adding node.
+
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Allow compilation with older GCC for ARM.
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
index 9b77e1c..9c886fc 100644
--- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c
@@ -132,6 +132,7 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
+ parentoffset);
grub_uint32_t *end = (void *) struct_end (fdt);
unsigned int entry_size = node_entry_size (name);
+ unsigned int struct_size = grub_fdt_get_size_dt_struct(fdt);
char *node_name;
SKIP_NODE_NAME(node_name, token, end);
@@ -167,6 +168,7 @@ insert:
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
grub_strcpy((char *) (token + 1), name);
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
+ grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
return ((grub_addr_t) token - (grub_addr_t) fdt
- grub_fdt_get_off_dt_struct(fdt));
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-05 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 15:28 fdt: fix for add_subnode() Leif Lindholm
2013-12-05 9:11 ` Francesco Lavra
2013-12-05 9:15 ` Vladimir 'φ-coder/phcoder' Serbinenko
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).