public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] tools: fdtgrep: Use unsigned chars for arrays
@ 2021-02-11  0:43 Samuel Dionne-Riel
  2021-02-13  4:17 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Dionne-Riel @ 2021-02-11  0:43 UTC (permalink / raw)
  To: u-boot

Otherwise, values over 127 end up prefixed with ffffff.

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: Simon Glass <sjg@chromium.org>
---

Minimal reproduction:

```
// repro.dts
/dts-v1/;

/ {
    ra = [ 7f ];
    rb = [ 80 ];
};
```

Steps used to compile:

 $ dtc repro.dts > repro.dtb

Without the fix:

 $ fdtgrep --include-node / repro.dtb
/ {
    ra = [7f];
    rb = [ffffff80];
};

With the fix:

 $ fdtgrep --include-node / repro.dtb
/ {
    ra = [7f];
    rb = [80];
};

---

 tools/fdtgrep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
index e4112b8f69..db512465db 100644
--- a/tools/fdtgrep.c
+++ b/tools/fdtgrep.c
@@ -213,7 +213,7 @@ static void utilfdt_print_data(const char *data, int len)
 	} else {
 		printf(" = [");
 		for (i = 0; i < len; i++)
-			printf("%02x%s", *p++, i < len - 1 ? " " : "");
+			printf("%02x%s", (unsigned char)*p++, i < len - 1 ? " " : "");
 		printf("]");
 	}
 }
-- 
2.29.2

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

* [PATCH] tools: fdtgrep: Use unsigned chars for arrays
  2021-02-11  0:43 [PATCH] tools: fdtgrep: Use unsigned chars for arrays Samuel Dionne-Riel
@ 2021-02-13  4:17 ` Simon Glass
  2021-03-16  5:58   ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2021-02-13  4:17 UTC (permalink / raw)
  To: u-boot

On Wed, 10 Feb 2021 at 17:43, Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
>
> Otherwise, values over 127 end up prefixed with ffffff.
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>
> Minimal reproduction:
>
> ```
> // repro.dts
> /dts-v1/;
>
> / {
>     ra = [ 7f ];
>     rb = [ 80 ];
> };
> ```
>
> Steps used to compile:
>
>  $ dtc repro.dts > repro.dtb
>
> Without the fix:
>
>  $ fdtgrep --include-node / repro.dtb
> / {
>     ra = [7f];
>     rb = [ffffff80];
> };
>
> With the fix:
>
>  $ fdtgrep --include-node / repro.dtb
> / {
>     ra = [7f];
>     rb = [80];
> };
>
> ---
>
>  tools/fdtgrep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [PATCH] tools: fdtgrep: Use unsigned chars for arrays
  2021-02-13  4:17 ` Simon Glass
@ 2021-03-16  5:58   ` Simon Glass
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-03-16  5:58 UTC (permalink / raw)
  To: u-boot

On Wed, 10 Feb 2021 at 17:43, Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
>
> Otherwise, values over 127 end up prefixed with ffffff.
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>
> Minimal reproduction:
>
> ```
> // repro.dts
> /dts-v1/;
>
> / {
>     ra = [ 7f ];
>     rb = [ 80 ];
> };
> ```
>
> Steps used to compile:
>
>  $ dtc repro.dts > repro.dtb
>
> Without the fix:
>
>  $ fdtgrep --include-node / repro.dtb
> / {
>     ra = [7f];
>     rb = [ffffff80];
> };
>
> With the fix:
>
>  $ fdtgrep --include-node / repro.dtb
> / {
>     ra = [7f];
>     rb = [80];
> };
>
> ---
>
>  tools/fdtgrep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

Applied to u-boot-dm/next, thanks!

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

end of thread, other threads:[~2021-03-16  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-11  0:43 [PATCH] tools: fdtgrep: Use unsigned chars for arrays Samuel Dionne-Riel
2021-02-13  4:17 ` Simon Glass
2021-03-16  5:58   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox