Browse Source
With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in fdtdump.c. The "len" parameter to valid_header() refers to a memory size, not a file offset, so the (unsigned) size_t is better fit, and fixes the warning nicely. In the main function we compare the difference between two pointers, which produces a signed ptrdiff_t type. However the while loop above the comparison makes sure that "p" always points before "endp" (by virtue of the limit in the memchr() call). This means "endp - p" is never negative, so we can safely cast this expression to an unsigned type. This fixes "make fdtdump", when compiled with -Wsign-compare. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20210611171040.25524-3-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>main
Andre Przywara
4 years ago
committed by
David Gibson
1 changed files with 3 additions and 3 deletions
Loading…
Reference in new issue