On 09/12/2017 06:28 AM, Daniel P. Berrange wrote: > Use the qcrypto_block_get_sector_size() value in the block > crypto driver instead of hardcoding 512 as the sector size. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > block/crypto.c | 34 ++++++++++++++++++---------------- > 1 file changed, 18 insertions(+), 16 deletions(-) > > diff --git a/block/crypto.c b/block/crypto.c > index d68cbac2ac..49d6d4c058 100644 > --- a/block/crypto.c > +++ b/block/crypto.c > @@ -392,8 +392,9 @@ block_crypto_co_readv(BlockDriverState *bs, int64_t > sector_num, > uint8_t *cipher_data = NULL; > QEMUIOVector hd_qiov; > int ret = 0; > + uint64_t sector_size = qcrypto_block_get_sector_size(crypto->block); > uint64_t payload_offset = > - qcrypto_block_get_payload_offset(crypto->block) / 512; > + qcrypto_block_get_payload_offset(crypto->block) / sector_size; > assert(payload_offset < (INT64_MAX / 512));
In addition to Max's comments, should the assert be dividing by sector_size instead of 512? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature