mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Gavin Shan <gshan@redhat.com>, Marc Zyngier <maz@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Shaoqin Huang <shahuang@redhat.com>,
	Ricardo Koller <ricarkol@google.com>,
	Will Deacon <will@kernel.org>, Arnd Bergmann <arnd@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>,
	Arnd Bergmann <arnd@arndb.de>,
	kvmarm@lists.linux.dev, Cornelia Huck <cohuck@redhat.com>,
	linux-kernel@vger.kernel.org, Zenghui Yu <yuzenghui@huawei.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	James Morse <james.morse@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: kvm: avoid overflow in integer division
Date: Thu, 18 May 2023 17:45:47 +0000	[thread overview]
Message-ID: <168443190240.3857986.13123115778800174028.b4-ty@linux.dev> (raw)
In-Reply-To: <20230517202352.793673-1-arnd@kernel.org>

On Wed, 17 May 2023 22:23:39 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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

      parent reply	other threads:[~2023-05-18 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 20:23 Arnd Bergmann
2023-05-18  7:30 ` Marc Zyngier
2023-05-18 12:14   ` Arnd Bergmann
2023-05-18 17:45 ` Oliver Upton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=168443190240.3857986.13123115778800174028.b4-ty@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cohuck@redhat.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=ricarkol@google.com \
    --cc=shahuang@redhat.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®