[PATCH] arm64: kvm: avoid overflow in integer division

Arnd Bergmann arnd at arndb.de
Thu May 18 05:14:46 PDT 2023


On Thu, May 18, 2023, at 09:30, Marc Zyngier wrote:
> On Wed, 17 May 2023 21:23:39 +0100,
> Arnd Bergmann <arnd at kernel.org> wrote:
>> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
>> index 3386bd28d267..6db9ef288ec3 100644
>> --- a/arch/arm64/kvm/mmu.c
>> +++ b/arch/arm64/kvm/mmu.c
>> @@ -92,8 +92,8 @@ static int kvm_mmu_split_nr_page_tables(u64 range)
>>  	int n = 0;
>>  
>>  	if (KVM_PGTABLE_MIN_BLOCK_LEVEL < 2)
>> -		n += DIV_ROUND_UP_ULL(range, PUD_SIZE);
>> -	n += DIV_ROUND_UP_ULL(range, PMD_SIZE);
>> +		n += DIV_ROUND_UP(range, PUD_SIZE);
>> +	n += DIV_ROUND_UP(range, PMD_SIZE);
>>  	return n;
>>  }
>
> This is against -next, right? Oliver, I assume you'll take this as a
> fix for Ricardo's series?

Yes, correct, I saw it after rebasing my tree from 6.4-rc2 to the
latest -next.

     Arnd



More information about the linux-arm-kernel mailing list