Re: [kvm-unit-tests PATCH v1 2/2] lib/alloc_page: Fix compilation issue on 32bit archs

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

 



On 14/07/2020 13.09, Claudio Imbrenda wrote:
> The assert in lib/alloc_page is hardcoded to long, and size_t is just
> an int on 32 bit architectures.
> 
> Adding a cast makes the compiler happy.
> 
> Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> ---
>  lib/alloc_page.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index fa3c527..617b003 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -29,11 +29,12 @@ void free_pages(void *mem, size_t size)
>  	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
>  		   "mem not page aligned: %p", mem);
>  
> -	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx", size);
> +	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx",
> +		(unsigned long)size);
>  
>  	assert_msg(size == 0 || (uintptr_t)mem == -size ||
>  		   (uintptr_t)mem + size > (uintptr_t)mem,
> -		   "mem + size overflow: %p + %#lx", mem, size);
> +		   "mem + size overflow: %p + %#lx", mem, (unsigned long)size);

Looking at lib/printf.c, it seems like it also supports %z ... have you
tried?

 Thomas




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux