diff --git a/block/qcow2.c b/block/qcow2.c index 3ace3b2209..dfac74c264 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2734,7 +2734,7 @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, bytes = new_length - offset; while (bytes) { - cur_bytes = MIN(bytes, INT_MAX); + cur_bytes = MIN(bytes, QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size)); ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, &host_offset, &meta); if (ret < 0) {