From: Huacai Chen <chenhuacai@kernel.org>
To: Bibo Mao <maobibo@loongson.cn>
Cc: cuitao <cuitao@kylinos.cn>,
zhaotianrui@loongson.cn, loongarch@lists.linux.dev,
kernel@xen0n.name
Subject: Re: [PATCH] LoongArch/KVM: Fix missing EMULATE_FAIL in ldptr default case of kvm_emu_mmio_read
Date: Mon, 27 Apr 2026 15:57:26 +0800 [thread overview]
Message-ID: <CAAhV-H7fgS6YPSLd6NrOG0YcFayQw-wNjKk4iQD0a_Cx1oJaNA@mail.gmail.com> (raw)
In-Reply-To: <9c1462c5-85ff-4de3-bee4-d394ffdfb63f@loongson.cn>
On Tue, Apr 14, 2026 at 9:42 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
> On 2026/4/14 上午9:31, cuitao wrote:
> > In the ldptr (0x24...0x27) opcode decoding path, the default case
> > only breaks out without setting ret to EMULATE_FAIL. This leaves
> > run->mmio.len uninitialized (stale from a previous MMIO operation)
> > while ret remains EMULATE_DO_MMIO, causing the code to proceed with
> > an incorrect MMIO length.
> >
> > Add ret = EMULATE_FAIL to match the other default branches in the
> > same function (e.g. the 0x28...0x2e and 0x38 cases).
> >
> > Signed-off-by: cuitao <cuitao@kylinos.cn>
> > ---
> > arch/loongarch/kvm/exit.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/loongarch/kvm/exit.c b/arch/loongarch/kvm/exit.c
> > index da0ad89f2eb7..3b95cd0f989b 100644
> > --- a/arch/loongarch/kvm/exit.c
> > +++ b/arch/loongarch/kvm/exit.c
> > @@ -390,6 +390,7 @@ int kvm_emu_mmio_read(struct kvm_vcpu *vcpu, larch_inst inst)
> > run->mmio.len = 8;
> > break;
> > default:
> > + ret = EMULATE_FAIL;
> > break;
> > }
> > break;
> >
> Good catch, thanks for doing this.
>
> Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Applied, thanks.
Huacai
prev parent reply other threads:[~2026-04-27 7:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 1:31 [PATCH] LoongArch/KVM: Fix missing EMULATE_FAIL in ldptr default case of kvm_emu_mmio_read cuitao
2026-04-14 1:39 ` Bibo Mao
2026-04-27 7:57 ` 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-H7fgS6YPSLd6NrOG0YcFayQw-wNjKk4iQD0a_Cx1oJaNA@mail.gmail.com \
--to=chenhuacai@kernel.org \
--cc=cuitao@kylinos.cn \
--cc=kernel@xen0n.name \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=zhaotianrui@loongson.cn \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).