Re: [PATCH 03/14] libfdt: fdt_grab_space_(): Fix comparison warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Sep 21, 2020 at 05:52:52PM +0100, Andre Przywara wrote:
> With -Wsign-compare, compilers warn about a mismatching signedness
> in a comparison in fdt_grab_space_().
> 
> All the involved values cannot be negative, so let's switch the types of
> the local variables to unsigned to make the compiler happy.
> 
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>

Applied, thanks.

> ---
>  libfdt/fdt_sw.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libfdt/fdt_sw.c b/libfdt/fdt_sw.c
> index 94ce4bb..d10a720 100644
> --- a/libfdt/fdt_sw.c
> +++ b/libfdt/fdt_sw.c
> @@ -93,8 +93,8 @@ static inline uint32_t sw_flags(void *fdt)
>  
>  static void *fdt_grab_space_(void *fdt, size_t len)
>  {
> -	int offset = fdt_size_dt_struct(fdt);
> -	int spaceleft;
> +	unsigned int offset = fdt_size_dt_struct(fdt);
> +	unsigned int spaceleft;
>  
>  	spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt)
>  		- fdt_size_dt_strings(fdt);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux