Re: [kvm-unit-tests PATCH v2 2/4] lib/alloc_page: change some parameter types

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

 



On 06/07/2020 18.43, Claudio Imbrenda wrote:
> For size parameters, size_t is probably semantically more appropriate
> than unsigned long (although they map to the same value).
> 
> For order, unsigned long is just too big. Also, get_order returns an
> unsigned int anyway.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx>
> ---
>  lib/alloc_page.h | 6 +++---
>  lib/alloc_page.c | 8 ++++----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 6181299..d9aceb7 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -11,10 +11,10 @@
>  bool page_alloc_initialized(void);
>  void page_alloc_ops_enable(void);
>  void *alloc_page(void);
> -void *alloc_pages(unsigned long order);
> +void *alloc_pages(unsigned int order);
>  void free_page(void *page);
> -void free_pages(void *mem, unsigned long size);
> -void free_pages_by_order(void *mem, unsigned long order);
> +void free_pages(void *mem, size_t size);
> +void free_pages_by_order(void *mem, unsigned int order);
>  unsigned int get_order(size_t size);
>  
>  #endif
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index 8769c3f..f16eaad 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -21,7 +21,7 @@ bool page_alloc_initialized(void)
>  	return freelist != 0;
>  }
>  
> -void free_pages(void *mem, unsigned long size)
> +void free_pages(void *mem, size_t size)

 Hi Claudio,

this patch broke 32-bit x86 and arm builds:

 https://travis-ci.com/github/huth/kvm-unit-tests/jobs/360418977#L693
 https://travis-ci.com/github/huth/kvm-unit-tests/jobs/360418980#L545

I think you either need to adjust the format string, or cast the argument.

 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