* [Qemu-devel] [PATCH] rbd: shift byte count as a 64-bit value
@ 2016-10-10 20:00 Paolo Bonzini
2016-10-10 20:16 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-10-10 20:00 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, qemu-stable, kwolf, eblake
Otherwise, reads of more than 2GB fail. Until commit
7bbca9e290a9c7c217b5a24fc6094e91e54bd05d, reads of 2^41
bytes succeeded at least theoretically.
In fact, pdiscard ought to receive a 64-bit integer as the
count for the same reason.
Reported by Coverity.
Fixes: 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d
Cc: qemu-stable@nongnu.org
Cc: kwolf@redhat.com
Cc: eblake@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/rbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index 6f9eb6f..f6e1d4b 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -733,7 +733,7 @@ static BlockAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs,
void *opaque)
{
return rbd_start_aio(bs, sector_num << BDRV_SECTOR_BITS, qiov,
- nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
+ (int64_t) nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
RBD_AIO_READ);
}
@@ -745,7 +745,7 @@ static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
void *opaque)
{
return rbd_start_aio(bs, sector_num << BDRV_SECTOR_BITS, qiov,
- nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
+ (int64_t) nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
RBD_AIO_WRITE);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] rbd: shift byte count as a 64-bit value
2016-10-10 20:00 [Qemu-devel] [PATCH] rbd: shift byte count as a 64-bit value Paolo Bonzini
@ 2016-10-10 20:16 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2016-10-10 20:16 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: qemu-block, qemu-stable, kwolf
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]
On 10/10/2016 03:00 PM, Paolo Bonzini wrote:
> Otherwise, reads of more than 2GB fail. Until commit
> 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d, reads of 2^41
> bytes succeeded at least theoretically.
I don't think the block layer ever passes a read request down to drivers
that large in the first place; we have a lot of code in io.c that
clamps/asserts things to be smaller than 2^31 (ie.
BDRV_REQUEST_MAX_SECTORS). So this may just be cleaning up something
that would become latent with a future block change to support larger
sizes, rather than an actual bug fix today. But it is worth making.
> In fact, pdiscard ought to receive a 64-bit integer as the
> count for the same reason.
Yes, auditing ALL of the block code for eliminating arbitrary 32-bit
limits would be a big project.
>
> Reported by Coverity.
>
> Fixes: 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d
> Cc: qemu-stable@nongnu.org
> Cc: kwolf@redhat.com
> Cc: eblake@redhat.com
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/rbd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-10 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 20:00 [Qemu-devel] [PATCH] rbd: shift byte count as a 64-bit value Paolo Bonzini
2016-10-10 20:16 ` Eric Blake
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.