Re: [PATCH 02/14] libfdt: fdt_mem_rsv(): Fix comparison warnings

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



On Mon, Sep 21, 2020 at 05:52:51PM +0100, Andre Przywara wrote:
> 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@xxxxxxx>

Applied, thanks.

> ---
>  libfdt/fdt_ro.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
> index e03570a..3c8d143 100644
> --- a/libfdt/fdt_ro.c
> +++ b/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))

-- 
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