Re: [PATCH v2 3/6] libfdt: fdt_create_with_flags(): Fix comparison warning

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



On Thu, Oct 01, 2020 at 05:46:27PM +0100, Andre Przywara wrote:
> 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@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 354f466..68b543c 100644
> --- a/libfdt/fdt_sw.c
> +++ b/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)

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