diff options
author | Avi Kivity <avi@redhat.com> | 2008-12-14 15:16:27 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-14 15:16:27 +0200 |
commit | 69c84d3c24e336683fe16501cdfc431110410c47 (patch) | |
tree | 6c10140d253f31ffbfabda9506e70457a486cfc9 | |
parent | ede93b2f0ec54f8ea1ce96e0e818f25cfa0fa897 (diff) |
kvm: libkvm: check for slot overlap using 64-bit arithmetickvm-81
otherwise, a slot that ends on the 4GB boundary wraps around, resulting
in a false positive, and leading to an early failure when attempting to get
the bios slot's dirty log (which doesn't have dirty logging enabled).
fixed broken display on 32-bit userspace.
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | kvm/libkvm/libkvm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kvm/libkvm/libkvm.c b/kvm/libkvm/libkvm.c index d4b1a7343..ede641784 100644 --- a/kvm/libkvm/libkvm.c +++ b/kvm/libkvm/libkvm.c @@ -623,8 +623,8 @@ int kvm_get_dirty_pages_range(kvm_context_t kvm, unsigned long phys_addr, unsigned long end_addr = phys_addr + len; for (i = 0; i < KVM_MAX_NUM_MEM_REGIONS; ++i) { - if ((slots[i].len && slots[i].phys_addr >= phys_addr) && - (slots[i].phys_addr + slots[i].len <= end_addr)) { + if ((slots[i].len && (uint64_t)slots[i].phys_addr >= phys_addr) + && ((uint64_t)slots[i].phys_addr + slots[i].len <= end_addr)) { r = kvm_get_map(kvm, KVM_GET_DIRTY_LOG, i, buf); if (r) return r; |