[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] block/backup: fix backup_cow_with_offload for l
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH 5/8] block/backup: fix backup_cow_with_offload for last cluster |
Date: |
Wed, 7 Aug 2019 11:07:47 +0300 |
We shouldn't try to copy bytes beyond EOF. Fix it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/backup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/backup.c b/block/backup.c
index a4d37d2d62..eb41e4af4f 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