aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2020-10-01 17:46:28 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2020-10-02 10:30:07 +1000
commit82525f41d59ec57a4e9325796a6f1baefc036236 (patch)
tree5e8f6fc845b6dd00a76c6b98a84e983a3a60deab
parentfb1f65f158327895acd360683e5c6da56d6944ea (diff)
downloaddtc-82525f41d59ec57a4e9325796a6f1baefc036236.zip
dtc-82525f41d59ec57a4e9325796a6f1baefc036236.tar.gz
dtc-82525f41d59ec57a4e9325796a6f1baefc036236.tar.bz2
libfdt: libfdt_wip: Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_setprop_inplace_namelen_partial(). fdt_getprop_namelen() will only return negative error values in "proplen" if the return value is NULL. So we can rely on "proplen" being positive in our case and can safely cast it to an unsigned type. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-5-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--libfdt/fdt_wip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c
index f64139e..c2d7566 100644
--- a/libfdt/fdt_wip.c
+++ b/libfdt/fdt_wip.c
@@ -23,7 +23,7 @@ int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
if (!propval)
return proplen;
- if (proplen < (len + idx))
+ if ((unsigned)proplen < (len + idx))
return -FDT_ERR_NOSPACE;
memcpy((char *)propval + idx, val, len);