[PATCH 04/19] KVM: arm64: Push checks for 64bit registers into the low-level accessors

Marc Zyngier maz at kernel.org
Fri Jul 8 01:05:25 PDT 2022


On Fri, 08 Jul 2022 07:13:36 +0100,
Reiji Watanabe <reijiw at google.com> wrote:
> 
> Hi Marc,
> 
> On Wed, Jul 6, 2022 at 9:43 AM Marc Zyngier <maz at kernel.org> wrote:
> >
> > Make sure the check occurs on every paths where we can pick
> > a sysreg from userspace, including the GICv3 paths.
> >
> > Signed-off-by: Marc Zyngier <maz at kernel.org>
> > ---
> >  arch/arm64/kvm/sys_regs.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index 0fbdb21a3600..89e7eddea937 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> > @@ -2656,6 +2656,10 @@ const struct sys_reg_desc *get_reg_by_id(u64 id,
> >  {
> >         struct sys_reg_params params;
> >
> > +       /* 64 bit is the only way */
> > +       if (KVM_REG_SIZE(id) != sizeof(__u64))
> > +               return NULL;
> 
> This doesn't seem to be necessary since the equivalent check
> is done by index_to_params().

Ah, well spotted. Amusing how many times we check for the same thing!

I'll simplify the patch and amend the commit message.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list