kvm: coalesced_mmio: remove one redundant check inside of coalesced_mmio_in_range()
PATCH 1/1 kvm: coalesced_mmio: remove one redundant check inside of coalesced_mmio_in_range()
We already check 'len' above to make sure it already isn't negative here, so indeed, (addr + len < addr) should never be happened.
--- virt/kvm/coalesced_mmio.c | 2 -- 1 file changed, 2 deletions(-)
virt/kvm/coalesced_mmio.c +0 -2
@@ -30,8 +30,6 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,*/ if (len <0 )return 0 ; -if (addr + len < addr) -return 0 ;if (addr < dev->zone.addr)return 0 ;if (addr + len > dev->zone.addr + dev->zone.size)
Signature · 1 line
1.9.1
Paolo Bonzini
maintainerQuoted 2 lines · Tiejun Chen
We already check 'len' above to make sure it already isn't negative here, so indeed, (addr + len < addr) should never be happened.
... except if there is an overflow.
Paolo
Quoted 19 lines
Signed-off-by Tiejun Chen <[email protected]>--- virt/kvm/coalesced_mmio.c | 2 -- 1 file changed, 2 deletions(-)virt/kvm/coalesced_mmio.c +0
-2@@ -30,8 +30,6 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,*/ if (len <0 )return 0 ; -if (addr + len < addr) -return 0 ;if (addr < dev->zone.addr)return 0 ;if (addr + len > dev->zone.addr + dev->zone.size)
Quoted 7 lines · Paolo Bonzini
Quoted 2 lines · Tiejun Chen
We already check 'len' above to make sure it already isn't negative here, so indeed, (addr + len < addr) should never be happened.
... except if there is an overflow.
Sorry, I'm confused. 'addr' is u64 and now 'len' would always be '>=0', what's your a so-called overflow here? And we also have such a check below, (addr + len > dev->zone.addr + dev->zone.size), so can this guarantee an overflow?
Thanks
Tiejun
Quoted 27 lines
Paolo
Quoted 11 lines
Signed-off-by Tiejun Chen <[email protected]>--- virt/kvm/coalesced_mmio.c | 2 -- 1 file changed, 2 deletions(-)virt/kvm/coalesced_mmio.c +0
-0virt/kvm/coalesced_mmio.c static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev, · line 35
Quoted 8 lines
virt/kvm/coalesced_mmio.c +0
-2@@ -30,8 +30,6 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,*/ if (len <0 )return 0 ; -if (addr + len < addr) -return 0 ;if (addr < dev->zone.addr)return 0 ;if (addr + len > dev->zone.addr + dev->zone.size)--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Tiejun
Quoted 7 lines · Paolo Bonzini
Quoted 2 lines · Tiejun Chen
We already check 'len' above to make sure it already isn't negative here, so indeed, (addr + len < addr) should never be happened.
... except if there is an overflow.
I think now I can understand what you mean.
Thanks
Tiejun