From: Binbin Wu <binbin.wu@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH gmem] KVM: Fix off-by-one error when querying attributes in xarray
Date: Tue, 24 Oct 2023 10:52:03 +0800 [thread overview]
Message-ID: <20d4f3fc-7491-dbab-392b-8b914332cafe@linux.intel.com> (raw)
In-Reply-To: <20231023203531.2461809-1-seanjc@google.com>
On 10/24/2023 4:35 AM, Sean Christopherson wrote:
> Subtract -1 from kvm_range_has_memory_attributes()'s @end when using
> xas_find(), as "end" is exclusive whereas xas_find() takes an inclusive
> "max" as the maximal index to find/return.
>
> Reported-by: Binbin Wu <binbin.wu@linux.intel.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Binbin Wu<binbin.wu@linux.intel.com>
> ---
> virt/kvm/kvm_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 959e866c84f0..12458959dd25 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2447,7 +2447,7 @@ bool kvm_range_has_memory_attributes(struct kvm *kvm, gfn_t start, gfn_t end,
> rcu_read_lock();
>
> if (!attrs) {
> - has_attrs = !xas_find(&xas, end);
> + has_attrs = !xas_find(&xas, end - 1);
> goto out;
> }
>
>
> base-commit: 911b515af3ec5f53992b9cc162cf7d3893c2fbe2
prev parent reply other threads:[~2023-10-24 2:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 20:35 Sean Christopherson
2023-10-24 2:52 ` Binbin Wu [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=20d4f3fc-7491-dbab-392b-8b914332cafe@linux.intel.com \
--to=binbin.wu@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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
Powered by JetHome