[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/36] block/backup: fix backup_cow_with_offload for last cluster
From: |
Max Reitz |
Subject: |
[PULL 07/36] block/backup: fix backup_cow_with_offload for last cluster |
Date: |
Thu, 10 Oct 2019 13:42:31 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
We shouldn't try to copy bytes beyond EOF. Fix it.
Fixes: 9ded4a0114968e
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/backup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
2.21.0
- [PULL 00/36] Block patches, Max Reitz, 2019/10/10
- [PULL 02/36] block: introduce aio task pool, Max Reitz, 2019/10/10
- [PULL 01/36] qemu-iotests: ignore leaks on failure paths in 026, Max Reitz, 2019/10/10
- [PULL 03/36] block/qcow2: refactor qcow2_co_preadv_part, Max Reitz, 2019/10/10
- [PULL 04/36] block/qcow2: refactor qcow2_co_pwritev_part, Max Reitz, 2019/10/10
- [PULL 05/36] block/qcow2: introduce parallel subrequest handling in read and write, Max Reitz, 2019/10/10
- [PULL 06/36] block/backup: fix max_transfer handling for copy_range, Max Reitz, 2019/10/10
- [PULL 07/36] block/backup: fix backup_cow_with_offload for last cluster,
Max Reitz <=
- [PULL 08/36] block/backup: split shareable copying part from backup_do_cow, Max Reitz, 2019/10/10
- [PULL 09/36] block/backup: improve comment about image fleecing, Max Reitz, 2019/10/10
- [PULL 11/36] block/backup: fix block-comment style, Max Reitz, 2019/10/10
- [PULL 10/36] block/backup: introduce BlockCopyState, Max Reitz, 2019/10/10
- [PULL 12/36] block: move block_copy from block/backup.c to separate file, Max Reitz, 2019/10/10
- [PULL 13/36] block: teach bdrv_debug_breakpoint skip filters with backing, Max Reitz, 2019/10/10
- [PULL 15/36] iotests: 257: drop unused Drive.device field, Max Reitz, 2019/10/10
- [PULL 17/36] qapi: group BlockDeviceStats fields, Max Reitz, 2019/10/10
- [PULL 14/36] iotests: prepare 124 and 257 bitmap querying for backup-top filter, Max Reitz, 2019/10/10
- [PULL 16/36] iotests: 257: drop device_add, Max Reitz, 2019/10/10