On 05.02.2024 17:02, Julien Grall wrote:
> On 05/02/2024 15:14, Andrew Cooper wrote:
>> -int bitmap_find_free_region(unsigned long *bitmap, int bits, int order)
>> +int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits,
>> unsigned int order)
>> {
>> unsigned long mask;
>> - int pages = 1 << order;
>> - int i;
>> + unsigned int pages = 1 << order;
>> + unsigned int i;
>
> ... I think your other patch is fixing a latent bug you introduced here.
> Before hand, if bits was "negative", we would return -ENOMEM. Now if we
> pass 2GB or higher, we would go through the loop.
>
> So I would fold the hunk from common/bitmap.c here.
>
>>
>> if(pages > BITS_PER_LONG)
>> return -EINVAL;
>
> [...]
>
>> -int bitmap_allocate_region(unsigned long *bitmap, int pos, int order)
>> +int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos,
>> + unsigned int order)
>> {
>> - int pages = 1 << order;
>> + unsigned int pages = 1 << order;
>> unsigned long mask = (1ul << (pages - 1));
>> - int index = pos/BITS_PER_LONG;
>> - int offset = pos - (index * BITS_PER_LONG);
>> + unsigned int index = pos/BITS_PER_LONG;
> NIT: While you modify the line, can you add a space before after / as
> you did above?
Instead of any of this - how about we finally purge this dead code? All
of bitmap_*_region() were dead in 3.2 (and perhaps even before), and they
are still dead.
Jan