[rtems commit] libfdt: fdt_mem_rsv(): Fix comparison warnings

Sebastian Huber sebh at rtems.org
Thu Dec 16 13:58:33 UTC 2021


Module:    rtems
Branch:    master
Commit:    0df1a41f62544ed631e768cbda46d19db4f74de1
Changeset: http://git.rtems.org/rtems/commit/?id=0df1a41f62544ed631e768cbda46d19db4f74de1

Author:    Andre Przywara <andre.przywara at arm.com>
Date:      Mon Sep 21 17:52:51 2020 +0100

libfdt: fdt_mem_rsv(): Fix comparison warnings

With -Wsign-compare, compilers warn about a mismatching signedness
in comparisons in fdt_mem_rsv().

Since all involved values must be positive, change the used types to be
unsigned.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
Message-Id: <20200921165303.9115-3-andre.przywara at arm.com>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>

---

 cpukit/dtc/libfdt/fdt_ro.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/dtc/libfdt/fdt_ro.c b/cpukit/dtc/libfdt/fdt_ro.c
index e03570a..3c8d143 100644
--- a/cpukit/dtc/libfdt/fdt_ro.c
+++ b/cpukit/dtc/libfdt/fdt_ro.c
@@ -157,8 +157,8 @@ int fdt_generate_phandle(const void *fdt, uint32_t *phandle)
 
 static const struct fdt_reserve_entry *fdt_mem_rsv(const void *fdt, int n)
 {
-	int offset = n * sizeof(struct fdt_reserve_entry);
-	int absoffset = fdt_off_mem_rsvmap(fdt) + offset;
+	unsigned int offset = n * sizeof(struct fdt_reserve_entry);
+	unsigned int absoffset = fdt_off_mem_rsvmap(fdt) + offset;
 
 	if (!can_assume(VALID_INPUT)) {
 		if (absoffset < fdt_off_mem_rsvmap(fdt))



More information about the vc mailing list