On 07/05/2017 07:57 AM, Stefan Hajnoczi wrote:
> Use qcow2_calc_prealloc_size() to get the required file size.
> 
> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
> Reviewed-by: Alberto Garcia <be...@igalia.com>
> ---

> +            for (sector_num = 0;
> +                 sector_num < ssize / BDRV_SECTOR_SIZE;
> +                 sector_num += pnum) {
> +                int nb_sectors = MAX(ssize / BDRV_SECTOR_SIZE - sector_num,
> +                                     INT_MAX);
> +                BlockDriverState *file;
> +                int64_t ret;
> +
> +                ret = bdrv_get_block_status_above(in_bs, NULL,
> +                                                  sector_num, nb_sectors,
> +                                                  &pnum, &file);

Shouldn't that be MIN(), not MAX(), in the computation of nb_sectors?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to