[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 5/7] block/backup: fix backup_cow_with_offload fo
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH v3 5/7] block/backup: fix backup_cow_with_offload for last cluster |
Date: |
Sat, 10 Aug 2019 22:31:53 +0300 |
We shouldn't try to copy bytes beyond EOF. Fix it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-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 228ba9423c..d482d93458 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -155,7 +155,7 @@ static int coroutine_fn
backup_cow_with_offload(BackupBlockJob *job,
int ret;
int nr_clusters;
BlockBackend *blk = job->common.blk;
- int nbytes = end - start;
+ int nbytes = MIN(end - start, job->len - start);
int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0;
assert(end - start < INT_MAX);
--
2.18.0
- [Qemu-devel] [PATCH v3 0/7] backup improvements, Vladimir Sementsov-Ogievskiy, 2019/08/10
- [Qemu-devel] [PATCH v3 5/7] block/backup: fix backup_cow_with_offload for last cluster,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-devel] [PATCH v3 2/7] block/backup: refactor write_flags, Vladimir Sementsov-Ogievskiy, 2019/08/10
- [Qemu-devel] [PATCH v3 1/7] block/backup: deal with zero detection, Vladimir Sementsov-Ogievskiy, 2019/08/10
- [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Vladimir Sementsov-Ogievskiy, 2019/08/10
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Max Reitz, 2019/08/12
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Vladimir Sementsov-Ogievskiy, 2019/08/12
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Max Reitz, 2019/08/12
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Vladimir Sementsov-Ogievskiy, 2019/08/12
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Vladimir Sementsov-Ogievskiy, 2019/08/13
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Max Reitz, 2019/08/13
- Re: [Qemu-devel] [PATCH v3 6/7] block/backup: teach backup_cow_with_bounce_buffer to copy more at once, Vladimir Sementsov-Ogievskiy, 2019/08/13