From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Marcus Comstedt <marcus-S4ne242Fi5M@public.gmane.org>
Cc: Devicetree Compiler
<devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Subject: Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
Date: Mon, 25 May 2020 15:15:55 +1000 [thread overview]
Message-ID: <20200525051555.GE23110@umbus.fritz.box> (raw)
In-Reply-To: <20200523151239.8849-1-marcus-S4ne242Fi5M@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]
On Sat, May 23, 2020 at 05:12:39PM +0200, Marcus Comstedt wrote:
> The symbol path already ends with a NUL character (something which is
> actually checked by the code) and this NUL is included in
> rel_path_len, so there is no need to add a second one.
>
> This change fixes incorrect display in the U-Boot command
> "fdt list /__symbols__" after applying an overlay with symbols.
>
> Signed-off-by: Marcus Comstedt <marcus-S4ne242Fi5M@public.gmane.org>
This patch causes "make check" failures.
> ---
> libfdt/fdt_overlay.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
> index b310e49..16d5aa0 100644
> --- a/libfdt/fdt_overlay.c
> +++ b/libfdt/fdt_overlay.c
> @@ -757,7 +757,7 @@ static int overlay_symbol_update(void *fdt, void *fdto)
> && (memcmp(s, "/__overlay__", len - 1) == 0)) {
> /* /<fragment-name>/__overlay__ */
> rel_path = "";
> - rel_path_len = 0;
> + rel_path_len = 1; /* Include NUL character */
> } else {
> /* Symbol refers to something that won't end
> * up in the target tree */
> @@ -794,7 +794,7 @@ static int overlay_symbol_update(void *fdt, void *fdto)
> }
>
> ret = fdt_setprop_placeholder(fdt, root_sym, name,
> - len + (len > 1) + rel_path_len + 1, &p);
> + len + (len > 1) + rel_path_len, &p);
> if (ret < 0)
> return ret;
>
> @@ -820,7 +820,6 @@ static int overlay_symbol_update(void *fdt, void *fdto)
>
> buf[len] = '/';
> memcpy(buf + len + 1, rel_path, rel_path_len);
> - buf[len + 1 + rel_path_len] = '\0';
> }
>
> return 0;
--
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 --]
next prev parent reply other threads:[~2020-05-25 5:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-23 15:12 [PATCH] libfdt: Remove superfluous NUL character from overlay symbols Marcus Comstedt
[not found] ` <20200523151239.8849-1-marcus-S4ne242Fi5M@public.gmane.org>
2020-05-25 5:15 ` David Gibson [this message]
[not found] ` <20200525051555.GE23110-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2020-05-25 6:53 ` Marcus Comstedt
[not found] <20200522164136.26069-1-marcus@mc.pp.se>
[not found] ` <CAPnjgZ1eU7xOgfGd_6bnUXs_98YOp8gfCz4YHHoHXtCY_h1_Hw@mail.gmail.com>
[not found] ` <yf94ks627a2.fsf@mc.pp.se>
[not found] ` <yf94ks627a2.fsf-S4ne242Fi5M@public.gmane.org>
2020-05-23 14:57 ` Simon Glass
2020-05-23 15:13 ` Marcus Comstedt
[not found] ` <yf9o8qe8z1c.fsf-S4ne242Fi5M@public.gmane.org>
2020-05-25 2:15 ` Simon Glass
[not found] ` <CAPnjgZ2C3HxdZqYAS_g-CEAq1CTVvdEvaz6NiCowpd11d9f5WA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-06-13 3:11 ` sjg-hpIqsD4AKlfQT0dZR+AlfA
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=20200525051555.GE23110@umbus.fritz.box \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcus-S4ne242Fi5M@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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 read-only IMAP folder(s) and NNTP newsgroup(s).