From: Huacai Chen <chenhuacai@kernel.org>
To: Bibo Mao <maobibo@loongson.cn>
Cc: Aurelien Jarno <aurel32@debian.org>,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] LoongArch: KVM: Fix base address calculation problem in kvm_eiointc_regs_access()
Date: Thu, 26 Mar 2026 15:50:09 +0800 [thread overview]
Message-ID: <CAAhV-H6T46kbfHz-mhFVMy=JGkF3Vz9SjBeyBx=OCLiGJWjR1w@mail.gmail.com> (raw)
In-Reply-To: <20260324031506.264062-1-maobibo@loongson.cn>
Applied, thanks.
Huacai
On Tue, Mar 24, 2026 at 11:15 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
> In function kvm_eiointc_regs_access(), register base address is caculated
> from array base address plus offset, the offset is absolute value from base
> address. The data type of array base address is u64, it should be converted
> into void * type and then plus the offset.
>
> Cc: <stable@vger.kernel.org>
> Fixes: d3e43a1f34ac ("LoongArch: KVM: Use 64-bit register definition for EIOINTC").
> Reported-by: Aurelien Jarno <aurel32@debian.org>
> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1131431
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> arch/loongarch/kvm/intc/eiointc.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
> index d2acb4d09e73..71bd67b57338 100644
> --- a/arch/loongarch/kvm/intc/eiointc.c
> +++ b/arch/loongarch/kvm/intc/eiointc.c
> @@ -472,34 +472,34 @@ static int kvm_eiointc_regs_access(struct kvm_device *dev,
> switch (addr) {
> case EIOINTC_NODETYPE_START ... EIOINTC_NODETYPE_END:
> offset = (addr - EIOINTC_NODETYPE_START) / 4;
> - p = s->nodetype + offset * 4;
> + p = (void *)s->nodetype + offset * 4;
> break;
> case EIOINTC_IPMAP_START ... EIOINTC_IPMAP_END:
> offset = (addr - EIOINTC_IPMAP_START) / 4;
> - p = &s->ipmap + offset * 4;
> + p = (void *)&s->ipmap + offset * 4;
> break;
> case EIOINTC_ENABLE_START ... EIOINTC_ENABLE_END:
> offset = (addr - EIOINTC_ENABLE_START) / 4;
> - p = s->enable + offset * 4;
> + p = (void *)s->enable + offset * 4;
> break;
> case EIOINTC_BOUNCE_START ... EIOINTC_BOUNCE_END:
> offset = (addr - EIOINTC_BOUNCE_START) / 4;
> - p = s->bounce + offset * 4;
> + p = (void *)s->bounce + offset * 4;
> break;
> case EIOINTC_ISR_START ... EIOINTC_ISR_END:
> offset = (addr - EIOINTC_ISR_START) / 4;
> - p = s->isr + offset * 4;
> + p = (void *)s->isr + offset * 4;
> break;
> case EIOINTC_COREISR_START ... EIOINTC_COREISR_END:
> if (cpu >= s->num_cpu)
> return -EINVAL;
>
> offset = (addr - EIOINTC_COREISR_START) / 4;
> - p = s->coreisr[cpu] + offset * 4;
> + p = (void *)s->coreisr[cpu] + offset * 4;
> break;
> case EIOINTC_COREMAP_START ... EIOINTC_COREMAP_END:
> offset = (addr - EIOINTC_COREMAP_START) / 4;
> - p = s->coremap + offset * 4;
> + p = (void *)s->coremap + offset * 4;
> break;
> default:
> kvm_err("%s: unknown eiointc register, addr = %d\n", __func__, addr);
>
> base-commit: c369299895a591d96745d6492d4888259b004a9e
> --
> 2.39.3
>
>
prev parent reply other threads:[~2026-03-26 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 3:15 [PATCH] LoongArch: KVM: Fix base address calculation problem in kvm_eiointc_regs_access() Bibo Mao
2026-03-26 7:50 ` Huacai Chen [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='CAAhV-H6T46kbfHz-mhFVMy=JGkF3Vz9SjBeyBx=OCLiGJWjR1w@mail.gmail.com' \
--to=chenhuacai@kernel.org \
--cc=aurel32@debian.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=stable@vger.kernel.org \
/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