Re: [kvm-unit-tests PATCH] lib/alloc_page: Revert to 'unsigned long' for @size params

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

 



On Tue, 14 Jul 2020 09:12:52 +0200
Thomas Huth <thuth@xxxxxxxxxx> wrote:

> On 14/07/2020 06.20, Sean Christopherson wrote:
> > Revert to using 'unsigned long' instead of 'size_t' for
> > free_pages() and get_order().  The recent change to size_t for
> > free_pages() breaks i386 with -Werror as the assert_msg() formats
> > expect unsigned longs, whereas size_t is an 'unsigned int' on i386
> > (though both longs and ints are 4 bytes).
> > 
> > Message formatting aside, unsigned long is the correct choice given
> > the current code base as alloc_pages() and free_pages_by_order()
> > explicitly expect, work on, and/or assert on the size being an
> > unsigned long.
> > 
> > Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> > Cc: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> > Cc: Andrew Jones <drjones@xxxxxxxxxx>
> > Cc: Jim Mattson <jmattson@xxxxxxxxxx>
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> > ---  
> [...]
> > diff --git a/lib/bitops.h b/lib/bitops.h
> > index 308aa86..dd015e8 100644
> > --- a/lib/bitops.h
> > +++ b/lib/bitops.h
> > @@ -79,7 +79,7 @@ static inline bool is_power_of_2(unsigned long n)
> >  	return n && !(n & (n - 1));
> >  }
> >  
> > -static inline unsigned int get_order(size_t size)
> > +static inline unsigned int get_order(unsigned long size)
> >  {
> >  	return size ? fls(size) + !is_power_of_2(size) : 0;
> >  }
> >   
> 
> get_order() already used size_t when it was introduced in commit
> f22e527df02ffaba ... is it necessary to switch it to unsigned long
> now?
> 
> Apart from that, this patch fixes the compilation problems, indeed, I
> just checked it in the travis-CI.
> 
> Tested-by: Thomas Huth <thuth@xxxxxxxxxx>

Yeah I don't think there is any reason to change get_order...




[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