summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2019-05-08 11:15:45 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-05-08 13:42:53 +0200
commit4ddc9204572c33f2eb91fbdb1d99d8078388b67d (patch)
tree84c5b7a326c8d083289afe89f410a78c6c73d3fd /virt
parentKVM: x86: use direct accessors for RIP and RSP (diff)
downloadlinux-4ddc9204572c33f2eb91fbdb1d99d8078388b67d.tar.xz
linux-4ddc9204572c33f2eb91fbdb1d99d8078388b67d.zip
KVM: Fix the bitmap range to copy during clear dirty
kvm_dirty_bitmap_bytes() will return the size of the dirty bitmap of the memslot rather than the size of bitmap passed over from the ioctl. Here for KVM_CLEAR_DIRTY_LOG we should only copy exactly the size of bitmap that covers kvm_clear_dirty_log.num_pages. Signed-off-by: Peter Xu <peterx@redhat.com> Cc: stable@vger.kernel.org Fixes: 2a31b9db153530df4aa02dac8c32837bf5f47019 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 53de2f946f9e..ad39c57de82d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1251,7 +1251,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
if (!dirty_bitmap)
return -ENOENT;
- n = kvm_dirty_bitmap_bytes(memslot);
+ n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
if (log->first_page > memslot->npages ||
log->num_pages > memslot->npages - log->first_page ||