diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-09-20 17:20:43 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-10-10 10:56:17 +0200 |
commit | 1048ddf0a32dcdaa952e581bd503d49adad527cc (patch) | |
tree | b50f7f1a7e2e6628dfe4f7c3a6021393287946eb /block/backup.c | |
parent | 981fb5810aa3f68797ee6e261db338bd78857614 (diff) |
block/backup: fix backup_cow_with_offload for last cluster
We shouldn't try to copy bytes beyond EOF. Fix it.
Fixes: 9ded4a0114968e
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20190920142056.12778-3-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/backup.c')
-rw-r--r-- | block/backup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/backup.c b/block/backup.c index db20249063..99177f03f8 100644 --- a/block/backup.c +++ b/block/backup.c @@ -161,7 +161,7 @@ static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job, assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size)); assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - nbytes = MIN(job->copy_range_size, end - start); + nbytes = MIN(job->copy_range_size, MIN(end, job->len) - start); nr_clusters = DIV_ROUND_UP(nbytes, job->cluster_size); bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size * nr_clusters); |