* [Qemu-devel] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev
@ 2017-04-26 8:40 Denis V. Lunev
2017-04-26 13:21 ` Eric Blake
2017-04-27 14:44 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Denis V. Lunev @ 2017-04-26 8:40 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Denis V. Lunev, Stefan Hajnoczi, Fam Zheng
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 <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Fam Zheng <famz@redhat.com>
---
block/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index a7142e0..1e1523b 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1452,7 +1452,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);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev
2017-04-26 8:40 [Qemu-devel] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev Denis V. Lunev
@ 2017-04-26 13:21 ` Eric Blake
2017-04-27 14:44 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2017-04-26 13:21 UTC (permalink / raw)
To: Denis V. Lunev, qemu-devel; +Cc: Fam Zheng, Stefan Hajnoczi, qemu-block
[-- Attachment #1: Type: text/plain, Size: 837 bytes --]
On 04/26/2017 03:40 AM, Denis V. Lunev wrote:
> 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 <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Fam Zheng <famz@redhat.com>
> ---
> block/io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev
2017-04-26 8:40 [Qemu-devel] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev Denis V. Lunev
2017-04-26 13:21 ` Eric Blake
@ 2017-04-27 14:44 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2017-04-27 14:44 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: qemu-devel, Fam Zheng, Stefan Hajnoczi, qemu-block
Am 26.04.2017 um 10:40 hat Denis V. Lunev geschrieben:
> 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 <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Fam Zheng <famz@redhat.com>
Thanks, applied to block-next.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-27 14:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-26 8:40 [Qemu-devel] [PATCH 1/1] block: fix alignment calculations in bdrv_co_do_zero_pwritev Denis V. Lunev
2017-04-26 13:21 ` Eric Blake
2017-04-27 14:44 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).