]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0062-block-alloc-track-avoid-premature-break.patch
update submodule and patches to 7.1.0
[pve-qemu.git] / debian / patches / pve / 0062-block-alloc-track-avoid-premature-break.patch
CommitLineData
39e84ba8
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Fabian Ebner <f.ebner@proxmox.com>
3Date: Wed, 22 Jun 2022 10:45:13 +0200
4Subject: [PATCH] block: alloc-track: avoid premature break
5
6While the bdrv_co_preadv() calls are expected to return 0 on success,
7qemu_iovec_memset() will return the number of bytes set (will be
8local_bytes, because the slice with that size was just initialized).
9
10Don't break out of the loop after the branch with qemu_iovec_memset(),
11because there might still be work to do. Additionally, ret is an int,
12which on 64-bit platforms is too small to hold the size_t returned by
13qemu_iovec_memset().
14
15The branch seems to be difficult to reach in practice, because the
16whole point of alloc-track is to be used with a backing device.
17
18Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
19---
20 block/alloc-track.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23diff --git a/block/alloc-track.c b/block/alloc-track.c
24index 6b50fbe537..c1160af04b 100644
25--- a/block/alloc-track.c
26+++ b/block/alloc-track.c
27@@ -174,7 +174,8 @@ static int coroutine_fn track_co_preadv(BlockDriverState *bs,
28 ret = bdrv_co_preadv(bs->backing, local_offset, local_bytes,
29 &local_qiov, flags);
30 } else {
31- ret = qemu_iovec_memset(&local_qiov, cur_offset, 0, local_bytes);
32+ qemu_iovec_memset(&local_qiov, cur_offset, 0, local_bytes);
33+ ret = 0;
34 }
35
36 if (ret != 0) {