Re: [PATCH 1/2] kvm: x86: Bounds-check argument to x86_exception_has_error_code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 12, 2018 at 3:59 PM Krish Sadhukhan
<krish.sadhukhan@xxxxxxxxxx> wrote:
>
>
>
> On 10/12/2018 11:04 AM, Jim Mattson wrote:
> > x86_exception_has_error_code should deterministically return false if
> > its operand is greater than or equal to 32.
> >
> > Fixes: 0447378a4a793 ("kvm: vmx: Nested VM-entry prereqs for event inj.")
> > Cc: Marc Orr <marcorr@xxxxxxxxxx>
> > Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> > ---
> >   arch/x86/kvm/x86.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> > index 67b9568613f3..b7890b248e64 100644
> > --- a/arch/x86/kvm/x86.h
> > +++ b/arch/x86/kvm/x86.h
> > @@ -116,7 +116,7 @@ static inline bool x86_exception_has_error_code(unsigned int vector)
> >                       BIT(NP_VECTOR) | BIT(SS_VECTOR) | BIT(GP_VECTOR) |
> >                       BIT(PF_VECTOR) | BIT(AC_VECTOR);
> >
> > -     return (1U << vector) & exception_has_error_code;
> > +     return vector < 32 && (1U << vector) & exception_has_error_code;
> >   }
> >
> >   static inline bool mmu_is_nested(struct kvm_vcpu *vcpu)
>
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>

Reviewed-by: Marc Orr <marcorr@xxxxxxxxxx>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux