diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-09-21 17:52:56 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2020-09-24 11:07:27 +1000 |
commit | faa76fc10bc5819899d6bc78535d212acaccbd6a (patch) | |
tree | a24c91724ae1789a70fcecd57faf983e6e379c76 /libfdt | |
parent | 54dca098531699dc8beeaf97e3525b9b5eb23b0a (diff) | |
download | device-tree-compiler-faa76fc10bc5819899d6bc78535d212acaccbd6a.tar.gz |
libfdt: fdt_splice_(): Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_splice_().
Since we just established that oldlen is not negative, we can safely
cast it to an unsigned type.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20200921165303.9115-8-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt')
-rw-r--r-- | libfdt/fdt_rw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c index 93e4a2b..68887b9 100644 --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -59,7 +59,7 @@ static int fdt_splice_(void *fdt, void *splicepoint, int oldlen, int newlen) if ((oldlen < 0) || (soff + oldlen < soff) || (soff + oldlen > dsize)) return -FDT_ERR_BADOFFSET; - if ((p < (char *)fdt) || (dsize + newlen < oldlen)) + if ((p < (char *)fdt) || (dsize + newlen < (unsigned)oldlen)) return -FDT_ERR_BADOFFSET; if (dsize - oldlen + newlen > fdt_totalsize(fdt)) return -FDT_ERR_NOSPACE; |