livetree: Fix a comparison of integers with different signedness

On some architectures we have:

	livetree.c: In function 'fixup_phandles':
	livetree.c:1237:54: error: comparison of integer expressions of different signedness: 'long int' and 'unsigned int' [-Werror=sign-compare]
	 1237 |                         if (offset < 0 || offset + 4 > p->val.len) {
	      |                                                      ^
	cc1: all warnings being treated as errors
	make: *** [Makefile:307: livetree.o] Error 1

Fixes: a26ef6400b ("Restore phandle references from __fixups__ node")
Closes: https://github.com/dgibson/dtc/issues/186
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Uwe Kleine-König 2026-06-08 18:33:05 +02:00 committed by David Gibson
parent d245851f06
commit c0e1d0fd58

View file

@ -1234,7 +1234,7 @@ void fixup_phandles(struct dt_info *dti, const char *name)
continue; continue;
offset = strtol(soffset, NULL, 0); offset = strtol(soffset, NULL, 0);
if (offset < 0 || offset + 4 > p->val.len) { if (offset < 0 || (unsigned int)offset + 4 > p->val.len) {
if (quiet < 1) if (quiet < 1)
fprintf(stderr, fprintf(stderr,
"Warning: Label %s contains invalid offset for property %s in node %s\n", "Warning: Label %s contains invalid offset for property %s in node %s\n",