Skip to contentSkip to conversation

libfdt: Remove superfluous NUL character from overlay symbols

PATCH New Marcus Comstedt 4 participants 7 messages May 22, 2020 – Jun 13, 2020 3 messages not in the archive Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libfdt: Remove superfluous NUL character from overlay symbols

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.

---
 scripts/dtc/libfdt/fdt_overlay.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
scripts/dtc/libfdt/fdt_overlay.c +2 -3
index c090e6991e..bd75e3dd78 100644
@@ -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;
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 libfdt: Remove superfluous NUL character from overlay symbols

Hi Marcus,

Quoted 5 lines · 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.

Quoted 7 lines

This change fixes incorrect display in "fdt list /__symbols" after applying an overlay with symbols.

---
 scripts/dtc/libfdt/fdt_overlay.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Could you please send this patch upstream?

Quoted 32 lines
scripts/dtc/libfdt/fdt_overlay.c +2 -4
index c090e6991e..bd75e3dd78 100644
@@ -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;
--
Quoted 2 lines

2.26.2

Regards,
Simon

#2 lore raw

PATCH 1/1 libfdt: Remove superfluous NUL character from overlay symbols

Hi Simon,

Quoted 1 line · Simon Glass

Could you please send this patch upstream?

Sure. But where is that, exactly?

// Marcus

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

+Devicetree Compiler

Quoted 7 lines · Marcus Comstedt

Hi Simon,

Simon Glass <[email protected]> writes:

Quoted 9 lines
Quoted 1 line

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

#5 lore raw

Hi Simon,

Quoted 3 lines · Simon Glass

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#7 lore raw
Quoted 8 lines · Marcus Comstedt

Hi Simon,

Quoted 2 lines · Simon Glass

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

Quoted 9 lines
Quoted 1 line

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

Thanks. Sent.

// Marcus

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ2C3HxdZqYAS_g-CEAq1CTVvdEvaz6NiCowpd11d9f5WA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by Simon Glass
#9 lore raw
Quoted 8 lines · Marcus Comstedt

Hi Simon,

Quoted 2 lines · Simon Glass

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

Quoted 9 lines
Quoted 1 line

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

Thanks. Sent.

// Marcus

Applied to u-boot-dm, thanks!