[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/34] block: fix alignment calculations in bdrv_co_d
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev |
Date: |
Fri, 28 Apr 2017 22:33:27 +0200 |
From: "Denis V. Lunev" <address@hidden>
tail_padding_bytes is calculated wrong. F.e. for
offset = 0
bytes = 2048
align = 512
we will have tail_padding_bytes = 512 which is definitely wrong. The patch
fixes that arithmetics.
Fortunately this problem is harmless, we will have 1 extra allocation and
free thus there is no need to put this into stable. The problem is here
from the very beginning.
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Stefan Hajnoczi <address@hidden>
CC: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index 80d6c62..40bd94f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1444,7 +1444,7 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild
*child,
int ret = 0;
head_padding_bytes = offset & (align - 1);
- tail_padding_bytes = align - ((offset + bytes) & (align - 1));
+ tail_padding_bytes = (align - (offset + bytes)) & (align - 1);
assert(flags & BDRV_REQ_ZERO_WRITE);
--
1.8.3.1
- [Qemu-devel] [PULL 10/34] iotests/051: Add test for empty filename, (continued)
- [Qemu-devel] [PULL 10/34] iotests/051: Add test for empty filename, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 09/34] block: An empty filename counts as no filename, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 11/34] qemu-iotests: Remove PERL_PROG and BC_PROG, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 12/34] qemu_iotests: Remove _readlink(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 13/34] block: Remove NULL check in bdrv_co_flush, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 15/34] Issue a deprecation warning if the user specifies the "-hdachs" option., Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 14/34] iotests: Launch qemu-nbd with -e 42, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 16/34] iotests: Fix typo in 026, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 18/34] block: Do not unref bs->file on error in BD's open, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 17/34] iotests: 109: Filter out "len" of failed jobs, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev,
Kevin Wolf <=
- [Qemu-devel] [PULL 20/34] qemu-img/convert: Use @opts for one thing only, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 22/34] qemu-img: Document backing options, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 21/34] qemu-img/convert: Move bs_n > 1 && -B check down, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 23/34] block/vhdx: Make vhdx_create() always set errp, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 07/34] qemu-iotests: Filter HMP readline escape characters, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 27/34] qcow2: Allow discard of final unaligned cluster, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 26/34] block: Add .bdrv_truncate() error messages, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 28/34] block: fix obvious coding style mistakes in block_int.h, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 25/34] block: Add errp to BD.bdrv_truncate(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 24/34] block: Add errp to b{lk,drv}_truncate(), Kevin Wolf, 2017/04/28