All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-23 15:12 Marcus Comstedt
       [not found] ` <20200523151239.8849-1-marcus-S4ne242Fi5M@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-23 15:12 UTC (permalink / raw)
  To: Devicetree Compiler; +Cc: Simon Glass, Marcus Comstedt

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>
---
 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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
       [not found] ` <20200523151239.8849-1-marcus-S4ne242Fi5M@public.gmane.org>
@ 2020-05-25  5:15   ` David Gibson
       [not found]     ` <20200525051555.GE23110-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: David Gibson @ 2020-05-25  5:15 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: Devicetree Compiler, Simon Glass

[-- 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 --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
       [not found]     ` <20200525051555.GE23110-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2020-05-25  6:53       ` Marcus Comstedt
  0 siblings, 0 replies; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-25  6:53 UTC (permalink / raw)
  To: David Gibson; +Cc: Devicetree Compiler, Simon Glass


Hi David,

David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> writes:

> This patch causes "make check" failures.

Ah.  This patch was for U-Boot, and Simon asked me to upstream it, but
I see now that in your repo you already have another fix (d9c55f85)
for the same issue.  Then applying my fix makes no sense for you of
course.  Sorry about that.


  // Marcus



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-06-13  3:11           ` sjg-hpIqsD4AKlfQT0dZR+AlfA
  0 siblings, 0 replies; 14+ messages in thread
From: sjg at google.com @ 2020-06-13  3:11 UTC (permalink / raw)
  To: u-boot

On Sat, 23 May 2020 at 09:13, Marcus Comstedt <marcus@mc.pp.se> wrote:
>
>
> Hi Simon,
>
> Simon Glass <sjg@chromium.org> writes:
>
> > You can send your patch to the mailing list on cc.
> >
> > Also see README.fdt-control fo the the git repo and other details.
>
>
> Thanks.  Sent.
>
>
>   // Marcus
>
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-06-13  3:11           ` sjg-hpIqsD4AKlfQT0dZR+AlfA
  0 siblings, 0 replies; 14+ messages in thread
From: sjg-hpIqsD4AKlfQT0dZR+AlfA @ 2020-06-13  3:11 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler, U-Boot Mailing List, Marcus Comstedt

On Sat, 23 May 2020 at 09:13, Marcus Comstedt <marcus-S4ne242Fi5M@public.gmane.org> wrote:
>
>
> Hi Simon,
>
> Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> writes:
>
> > You can send your patch to the mailing list on cc.
> >
> > Also see README.fdt-control fo the the git repo and other details.
>
>
> Thanks.  Sent.
>
>
>   // Marcus
>
>

Reviewed-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-25  2:15           ` Simon Glass
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2020-05-25  2:15 UTC (permalink / raw)
  To: u-boot

On Sat, 23 May 2020 at 09:13, Marcus Comstedt <marcus@mc.pp.se> wrote:
>
>
> Hi Simon,
>
> Simon Glass <sjg@chromium.org> writes:
>
> > You can send your patch to the mailing list on cc.
> >
> > Also see README.fdt-control fo the the git repo and other details.
>
>
> Thanks.  Sent.
>
>
>   // Marcus
>
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-25  2:15           ` Simon Glass
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2020-05-25  2:15 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: Devicetree Compiler, U-Boot Mailing List

On Sat, 23 May 2020 at 09:13, Marcus Comstedt <marcus-S4ne242Fi5M@public.gmane.org> wrote:
>
>
> Hi Simon,
>
> Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> writes:
>
> > You can send your patch to the mailing list on cc.
> >
> > Also see README.fdt-control fo the the git repo and other details.
>
>
> Thanks.  Sent.
>
>
>   // Marcus
>
>

Reviewed-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
  2020-05-23 14:57       ` Simon Glass
@ 2020-05-23 15:13         ` Marcus Comstedt
  -1 siblings, 0 replies; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-23 15:13 UTC (permalink / raw)
  To: u-boot


Hi Simon,

Simon Glass <sjg@chromium.org> writes:

> You can send your patch to the mailing list on cc.
>
> Also see README.fdt-control fo the the git repo and other details.


Thanks.  Sent.


  // Marcus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-23 15:13         ` Marcus Comstedt
  0 siblings, 0 replies; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-23 15:13 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler, U-Boot Mailing List


Hi Simon,

Simon Glass <sjg@chromium.org> writes:

> You can send your patch to the mailing list on cc.
>
> Also see README.fdt-control fo the the git repo and other details.


Thanks.  Sent.


  // Marcus



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-23 14:57       ` Simon Glass
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2020-05-23 14:57 UTC (permalink / raw)
  To: u-boot

+Devicetree Compiler

On Sat, 23 May 2020 at 05:57, Marcus Comstedt <marcus@mc.pp.se> wrote:
>
>
> Hi Simon,
>
>
> Simon Glass <sjg@chromium.org> writes:
>
> > Could you please send this patch upstream?
>
>
> Sure.  But where is that, exactly?
>
>
>   // Marcus
>
>

Hi Marcus,

You can send your patch to the mailing list on cc.

Also see README.fdt-control fo the the git repo and other details.

Regards,
Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-23 14:57       ` Simon Glass
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2020-05-23 14:57 UTC (permalink / raw)
  To: Marcus Comstedt, Devicetree Compiler; +Cc: U-Boot Mailing List

+Devicetree Compiler

On Sat, 23 May 2020 at 05:57, Marcus Comstedt <marcus-S4ne242Fi5M@public.gmane.org> wrote:
>
>
> Hi Simon,
>
>
> Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> writes:
>
> > Could you please send this patch upstream?
>
>
> Sure.  But where is that, exactly?
>
>
>   // Marcus
>
>

Hi Marcus,

You can send your patch to the mailing list on cc.

Also see README.fdt-control fo the the git repo and other details.

Regards,
Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
  2020-05-22 23:13 ` Simon Glass
@ 2020-05-23 11:57   ` Marcus Comstedt
  2020-05-23 14:57       ` Simon Glass
  0 siblings, 1 reply; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-23 11:57 UTC (permalink / raw)
  To: u-boot


Hi Simon,


Simon Glass <sjg@chromium.org> writes:

> Could you please send this patch upstream?


Sure.  But where is that, exactly?


  // Marcus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
  2020-05-22 16:41 Marcus Comstedt
@ 2020-05-22 23:13 ` Simon Glass
  2020-05-23 11:57   ` Marcus Comstedt
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2020-05-22 23:13 UTC (permalink / raw)
  To: u-boot

Hi Marcus,

On Fri, 22 May 2020 at 10:42, Marcus Comstedt <marcus@mc.pp.se> 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 "fdt list /__symbols" after
> applying an overlay with symbols.
>
> Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
> ---
>  scripts/dtc/libfdt/fdt_overlay.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Could you please send this patch upstream?

>
> diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c
> index c090e6991e..bd75e3dd78 100644
> --- a/scripts/dtc/libfdt/fdt_overlay.c
> +++ b/scripts/dtc/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;
> --
> 2.26.2
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] libfdt: Remove superfluous NUL character from overlay symbols
@ 2020-05-22 16:41 Marcus Comstedt
  2020-05-22 23:13 ` Simon Glass
  0 siblings, 1 reply; 14+ messages in thread
From: Marcus Comstedt @ 2020-05-22 16:41 UTC (permalink / raw)
  To: u-boot

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 "fdt list /__symbols" after
applying an overlay with symbols.

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
---
 scripts/dtc/libfdt/fdt_overlay.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c
index c090e6991e..bd75e3dd78 100644
--- a/scripts/dtc/libfdt/fdt_overlay.c
+++ b/scripts/dtc/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;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-06-13  3:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
     [not found]     ` <20200525051555.GE23110-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2020-05-25  6:53       ` Marcus Comstedt
  -- strict thread matches above, loose matches on Subject: below --
2020-05-22 16:41 Marcus Comstedt
2020-05-22 23:13 ` Simon Glass
2020-05-23 11:57   ` Marcus Comstedt
2020-05-23 14:57     ` Simon Glass
2020-05-23 14:57       ` Simon Glass
2020-05-23 15:13       ` Marcus Comstedt
2020-05-23 15:13         ` Marcus Comstedt
2020-05-25  2:15         ` Simon Glass
2020-05-25  2:15           ` Simon Glass
2020-06-13  3:11         ` sjg at google.com
2020-06-13  3:11           ` sjg-hpIqsD4AKlfQT0dZR+AlfA

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.