[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <168443190240.3857986.13123115778800174028.b4-ty@linux.dev>
Date: Thu, 18 May 2023 17:45:47 +0000
From: Oliver Upton <oliver.upton@...ux.dev>
To: Gavin Shan <gshan@...hat.com>, Marc Zyngier <maz@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Shaoqin Huang <shahuang@...hat.com>,
Ricardo Koller <ricarkol@...gle.com>,
Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...nel.org>
Cc: Oliver Upton <oliver.upton@...ux.dev>,
Arnd Bergmann <arnd@...db.de>, kvmarm@...ts.linux.dev,
Cornelia Huck <cohuck@...hat.com>,
linux-kernel@...r.kernel.org, Zenghui Yu <yuzenghui@...wei.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
James Morse <james.morse@....com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] arm64: kvm: avoid overflow in integer division
On Wed, 17 May 2023 22:23:39 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> The newly added kvm_mmu_split_nr_page_tables() function uses DIV_ROUND_DOWN_ULL()
> to divide 64-bit addresses, but this requires a 32-bit divisior, and PUD_SIZE
> may exceed that when 64KB pages are used:
>
> arch/arm64/kvm/mmu.c: In function 'kvm_mmu_split_nr_page_tables':
> include/linux/math.h:42:64: error: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '68719476736' to '0' [-Werror=overflow]
> 42 | DIV_ROUND_DOWN_ULL((unsigned long long)(ll) + (d) - 1, (d))
> | ^~~
> include/linux/math.h:39:47: note: in definition of macro 'DIV_ROUND_DOWN_ULL'
> 39 | #define DIV_ROUND_DOWN_ULL(ll, d) div_u64(ll, d)
> | ^
> arch/arm64/kvm/mmu.c:95:22: note: in expansion of macro 'DIV_ROUND_UP_ULL'
> 95 | n += DIV_ROUND_UP_ULL(range, PUD_SIZE);
> | ^~~~~~~~~~~~~~~~
>
> [...]
Applied to kvmarm/next, thanks!
[1/1] arm64: kvm: avoid overflow in integer division
https://git.kernel.org/kvmarm/kvmarm/c/14c3555f055d
--
Best,
Oliver
Powered by blists - more mailing lists