Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VoEMu-0008ER-Qz for mharc-grub-devel@gnu.org; Wed, 04 Dec 2013 10:28:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoEMo-0008BJ-PY for grub-devel@gnu.org; Wed, 04 Dec 2013 10:28:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoEMk-0003Fg-13 for grub-devel@gnu.org; Wed, 04 Dec 2013 10:27:58 -0500 Received: from mail-qc0-f170.google.com ([209.85.216.170]:63188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoEMj-0003FV-Sn for grub-devel@gnu.org; Wed, 04 Dec 2013 10:27:53 -0500 Received: by mail-qc0-f170.google.com with SMTP id x13so2279626qcv.15 for ; Wed, 04 Dec 2013 07:27:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=q7WV3jhz5Z6LwpfPTnImL407lCcAMM/clgzZl/VwPAs=; b=fSq6SJYOlJF6hipsaMwzhiGWNNwIg8jYxlLqOFgJJouy4C5Iw/fpuusr+5rsazKKQO r/Nt0WdubJyVNY82dru0+cvXw5+j5rfq0aO+7JE9OxA85ooeXTtvVp3widqnGc1sCs19 lldcCED8OeJYZvk75pin9Aiog3rASTl9GpBjR8PtNPuboMvyGEMPER+fz3Q9tvlRa/Ly aPAIHxal6e+Hy70sntWGBHwa3Bkqw9iv9y5GlMGRx5ncLYap4mwmtZ6SUVHGdq9Cg3js zCbDALm5Tuto47rlXCzzK1UxByLxHyB9pMSOHX2hrK4tD/scCteUQedXVt0LcSNoep4J +IfA== X-Gm-Message-State: ALoCoQkkjjTQOMleHJTiXOp/xpo+aUBBSf/yEr8hT3/LhEI9gmOKZcZsmr7LQXSmYcU3wC8OzGDs X-Received: by 10.224.125.195 with SMTP id z3mr138639835qar.13.1386170873038; Wed, 04 Dec 2013 07:27:53 -0800 (PST) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id nq5sm13253767qeb.8.2013.12.04.07.27.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 04 Dec 2013 07:27:51 -0800 (PST) Date: Wed, 4 Dec 2013 16:28:07 +0100 From: Leif Lindholm To: grub-devel@gnu.org Subject: fdt: fix for add_subnode() Message-ID: <20131204152807.GW24997@rocoto.smurfnet.nu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="adJ1OR3c6QgCpb/j" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.216.170 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2013 15:28:03 -0000 --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The current fdt support fails to update the size of the dt_struct after adding a new node. Attached is the suggested fix. / Leif --adJ1OR3c6QgCpb/j Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-grub-core-lib-fdt.c-correctly-update-size_dt_struct-.patch" From d424d2fe0581c1f036aae9a8b0371d65d007ef61 Mon Sep 17 00:00:00 2001 From: Leif Lindholm 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 + + * grub-core/kern/fdt.c: Update struct size when adding node. + 2013-12-04 Vladimir Serbinenko * 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 --adJ1OR3c6QgCpb/j--