From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Binbin Wu <binbin.wu@linux.intel.com>,
Sean Christopherson <seanjc@google.com>
Subject: [PATCH gmem] KVM: Fix off-by-one error when querying attributes in xarray
Date: Mon, 23 Oct 2023 13:35:31 -0700 [thread overview]
Message-ID: <20231023203531.2461809-1-seanjc@google.com> (raw)
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>
---
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
--
2.42.0.758.gaed0368e0e-goog
next reply other threads:[~2023-10-23 20:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 20:35 Sean Christopherson [this message]
2023-10-24 2:52 ` Binbin Wu
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=20231023203531.2461809-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=binbin.wu@linux.intel.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
all inboxes | Powered by JetHome®