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

From: Arnd Bergmann
Date: Thu May 18 2023 - 08:15:11 EST


On Thu, May 18, 2023, at 09:30, Marc Zyngier wrote:
> On Wed, 17 May 2023 21:23:39 +0100,
> Arnd Bergmann <arnd@xxxxxxxxxx> 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