[rtems commit] libfdt: fdt_splice_(): Fix comparison warning
Sebastian Huber
sebh at rtems.org
Thu Dec 16 13:58:33 UTC 2021
Module: rtems
Branch: master
Commit: 28f7e7635d7f2c32c56ddb87e6da76512a5b520a
Changeset: http://git.rtems.org/rtems/commit/?id=28f7e7635d7f2c32c56ddb87e6da76512a5b520a
Author: Andre Przywara <andre.przywara at arm.com>
Date: Mon Sep 21 17:52:56 2020 +0100
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 at arm.com>
Message-Id: <20200921165303.9115-8-andre.przywara at arm.com>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
cpukit/dtc/libfdt/fdt_rw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 93e4a2b..68887b9 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/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;
More information about the vc
mailing list