qcow2: Improve check for overlapping allocations

The old code detected an overlapping allocation even when the
allocations didn't actually overlap, but were only adjacent.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Kevin Wolf 2013-03-26 17:49:57 +01:00 committed by Stefan Hajnoczi
parent 17a71e5823
commit d9d74f4177
2 changed files with 120 additions and 120 deletions

View file

@ -773,7 +773,7 @@ static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset,
uint64_t old_start = old_alloc->offset >> s->cluster_bits;
uint64_t old_end = old_start + old_alloc->nb_clusters;
if (end < old_start || start > old_end) {
if (end <= old_start || start >= old_end) {
/* No intersection */
} else {
if (start < old_start) {