public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: cleanup DR6/DR7 reserved bits checks
Date: Tue, 2 Feb 2021 10:27:27 -0800	[thread overview]
Message-ID: <YBmZj0uukimn3G7E@google.com> (raw)
In-Reply-To: <20210202170246.89436-1-pbonzini@redhat.com>

On Tue, Feb 02, 2021, Paolo Bonzini wrote:
> kvm_dr6_valid and kvm_dr7_valid check that bits 63:32 are zero.  Using
> them makes it easier to review the code for inconsistencies.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/kvm/x86.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 97674204bf44..e52e38f8c74d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4414,9 +4414,9 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
>  	if (dbgregs->flags)
>  		return -EINVAL;
>  
> -	if (dbgregs->dr6 & ~0xffffffffull)

Oof, you weren't kidding.

Reviewed-by: Sean Christopherson <seanjc@google.com> 

> +	if (!kvm_dr6_valid(dbgregs->dr6))
>  		return -EINVAL;
> -	if (dbgregs->dr7 & ~0xffffffffull)
> +	if (!kvm_dr7_valid(dbgregs->dr7))
>  		return -EINVAL;
>  
>  	memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db));
> -- 
> 2.26.2
> 

      reply	other threads:[~2021-02-02 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 17:02 [PATCH] KVM: cleanup DR6/DR7 reserved bits checks Paolo Bonzini
2021-02-02 18:27 ` Sean Christopherson [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=YBmZj0uukimn3G7E@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.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