aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--virt/kvm/coalesced_mmio.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index a6ec206f36ba..88b2fe3ddf42 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -28,9 +28,15 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
28 * (addr,len) is fully included in 28 * (addr,len) is fully included in
29 * (zone->addr, zone->size) 29 * (zone->addr, zone->size)
30 */ 30 */
31 31 if (len < 0)
32 return (dev->zone.addr <= addr && 32 return 0;
33 addr + len <= dev->zone.addr + dev->zone.size); 33 if (addr + len < addr)
34 return 0;
35 if (addr < dev->zone.addr)
36 return 0;
37 if (addr + len > dev->zone.addr + dev->zone.size)
38 return 0;
39 return 1;
34} 40}
35 41
36static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev) 42static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev)