From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Dionne-Riel Date: Wed, 10 Feb 2021 19:43:09 -0500 Subject: [PATCH] tools: fdtgrep: Use unsigned chars for arrays Message-ID: <20210210194309.07d1dec7@DUFFMAN> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Otherwise, values over 127 end up prefixed with ffffff. Signed-off-by: Samuel Dionne-Riel Cc: Simon Glass --- 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