[U-Boot] Build warnings in libfdt

Tom Rini trini at konsulko.com
Sun Nov 17 13:14:37 UTC 2019


On Sun, Nov 17, 2019 at 11:11:43AM +0100, Heinrich Schuchardt wrote:
> Hello Simon,
> 
> when building U-Boot HEAD with GCC 9.2.1 I get a bunch of build warnings
> which I did not see before your recent libfdt update.
> 
> scripts/dtc/libfdt/fdt.c: In function ‘fdt_offset_ptr’:
> scripts/dtc/libfdt/fdt.c:137:18: warning: comparison of integer
> expressions of different signedness: ‘unsigned int’ and ‘int’
> [-Wsign-compare]
>   137 |   if ((absoffset < offset)
>       |                  ^
> scripts/dtc/libfdt/fdt.c:143:23: warning: comparison of integer
> expressions of different signedness: ‘unsigned int’ and ‘int’
> [-Wsign-compare]
>   143 |   if (((offset + len) < offset)
>       |                       ^
> scripts/dtc/libfdt/fdt.c: In function ‘fdt_move’:
> scripts/dtc/libfdt/fdt.c:307:25: warning: comparison of integer
> expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and
> ‘int’ [-Wsign-compare]
>   307 |  if (fdt_totalsize(fdt) > bufsize)
>       |                         ^
> scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_get_string’:
> scripts/dtc/libfdt/fdt_ro.c:56:16: warning: comparison of integer
> expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and
> ‘int32_t’ {aka ‘int’} [-Wsign-compare]
>    56 |  if (absoffset >= totalsize)
>       |                ^~
> scripts/dtc/libfdt/fdt_ro.c:64:18: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned
> int’} [-Wsign-compare]
>    64 |    if (stroffset >= fdt_size_dt_strings(fdt))
>       |                  ^~
> scripts/dtc/libfdt/fdt_ro.c:71:21: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned
> int’} [-Wsign-compare]
>    71 |       || (stroffset < -fdt_size_dt_strings(fdt)))
>       |                     ^
> scripts/dtc/libfdt/fdt_ro.c:73:20: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long
> unsigned int’} [-Wsign-compare]
>    73 |   if ((-stroffset) < len)
>       |                    ^
> scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_mem_rsv’:
> scripts/dtc/libfdt/fdt_ro.c:164:17: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned
> int’} [-Wsign-compare]
>   164 |   if (absoffset < fdt_off_mem_rsvmap(fdt))
>       |                 ^
> scripts/dtc/libfdt/fdt_ro.c:166:17: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘long unsigned int’
> [-Wsign-compare]
>   166 |   if (absoffset > fdt_totalsize(fdt) -
>       |                 ^
> scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_node_offset_by_phandle’:
> scripts/dtc/libfdt/fdt_ro.c:682:33: warning: comparison of integer
> expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and
> ‘int’ [-Wsign-compare]
>   682 |  if ((phandle == 0) || (phandle == -1))
>       |                                 ^~
> scripts/dtc/libfdt/fdt_wip.c: In function
> ‘fdt_setprop_inplace_namelen_partial’:
> scripts/dtc/libfdt/fdt_wip.c:26:14: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned
> int’} [-Wsign-compare]
>    26 |  if (proplen < (len + idx))
>       |              ^
> scripts/dtc/libfdt/fdt_sw.c: In function ‘fdt_grab_space_’:
> scripts/dtc/libfdt/fdt_sw.c:105:20: warning: comparison of integer
> expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’}
> and ‘int’ [-Wsign-compare]
>   105 |  if ((offset + len < offset) || (offset + len > spaceleft))
>       |                    ^
> scripts/dtc/libfdt/fdt_sw.c:105:47: warning: comparison of integer
> expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’}
> and ‘int’ [-Wsign-compare]
>   105 |  if ((offset + len < offset) || (offset + len > spaceleft))
>       |                                               ^
> scripts/dtc/libfdt/fdt_sw.c: In function ‘fdt_create_with_flags’:
> scripts/dtc/libfdt/fdt_sw.c:118:14: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘long unsigned int’
> [-Wsign-compare]
>   118 |  if (bufsize < hdrsize)
>       |              ^
> scripts/dtc/libfdt/fdt_sw.c: In function ‘fdt_resize’:
> scripts/dtc/libfdt/fdt_sw.c:164:28: warning: comparison of integer
> expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’}
> and ‘int’ [-Wsign-compare]
>   164 |  if ((headsize + tailsize) > bufsize)
>       |                            ^
> scripts/dtc/libfdt/fdt_sw.c: In function ‘fdt_add_string_’:
> scripts/dtc/libfdt/fdt_sw.c:258:34: warning: comparison of integer
> expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and
> ‘int’ [-Wsign-compare]
>   258 |  if (fdt_totalsize(fdt) + offset < struct_top)
>       |                                  ^
> scripts/dtc/libfdt/fdt_strerror.c: In function ‘fdt_strerror’:
> scripts/dtc/libfdt/fdt_strerror.c:51:18: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘long unsigned int’
> [-Wsign-compare]
>    51 |  else if (errval > -FDT_ERRTABSIZE) {
>       |                  ^
> scripts/dtc/libfdt/fdt_overlay.c: In function
> ‘overlay_update_local_node_references’:
> scripts/dtc/libfdt/fdt_overlay.c:253:17: warning: comparison of integer
> expressions of different signedness: ‘int’ and ‘long unsigned int’
> [-Wsign-compare]
>   253 |   for (i = 0; i < (fixup_len / sizeof(uint32_t)); i++) {
>       |                 ^

Since these also exist in upstream dtc, fixing them there is the best
place to start.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191117/a838b862/attachment.sig>


More information about the U-Boot mailing list