[PATCH 19/35] libfdt: fdt_create_with_flags(): Fix comparison warning

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Dec 14 19:38:05 UTC 2021


From: Andre Przywara <andre.przywara at arm.com>

With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_create_with_flags().

By making hdrsize a signed integer (we are sure it's a very small
number), we avoid all the casts and have matching types.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
Message-Id: <20201001164630.4980-4-andre.przywara at arm.com>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 cpukit/dtc/libfdt/fdt_sw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/dtc/libfdt/fdt_sw.c b/cpukit/dtc/libfdt/fdt_sw.c
index 354f46674b..68b543c4df 100644
--- a/cpukit/dtc/libfdt/fdt_sw.c
+++ b/cpukit/dtc/libfdt/fdt_sw.c
@@ -108,8 +108,8 @@ static void *fdt_grab_space_(void *fdt, size_t len)
 
 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags)
 {
-	const size_t hdrsize = FDT_ALIGN(sizeof(struct fdt_header),
-					 sizeof(struct fdt_reserve_entry));
+	const int hdrsize = FDT_ALIGN(sizeof(struct fdt_header),
+				      sizeof(struct fdt_reserve_entry));
 	void *fdt = buf;
 
 	if (bufsize < hdrsize)
-- 
2.31.1



More information about the devel mailing list