diff options
author | Andre Przywara <andre.przywara@arm.com> | 2021-06-11 18:10:34 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-06-15 12:35:54 +1000 |
commit | 24e7f511fd4acaf48d25374f88dbdbdb277e6a26 (patch) | |
tree | b647774fc30f8bec8cdcac90ef4765b5c29a9b88 /flattree.c | |
parent | b6910bec11614980a21e46fbccc35934b671bd81 (diff) | |
download | dtc-24e7f511fd4acaf48d25374f88dbdbdb277e6a26.zip dtc-24e7f511fd4acaf48d25374f88dbdbdb277e6a26.tar.gz dtc-24e7f511fd4acaf48d25374f88dbdbdb277e6a26.tar.bz2 |
fdtdump: Fix signedness comparisons warnings
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>
Diffstat (limited to 'flattree.c')
0 files changed, 0 insertions, 0 deletions