On Thu, Apr 30, 2015 at 01:11:40PM +0300, Alberto Garcia wrote:
>  Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)
>  {
>      BDRVQcowState *s = bs->opaque;
>      Qcow2Cache *c;
> -    int i;
>  
>      c = g_new0(Qcow2Cache, 1);
>      c->size = num_tables;
> +    c->table_size = s->cluster_size;

This assumes c->table_size meets bs' memory alignment requirements.  The
following would be safer:

c->table_size = QEMU_ALIGN_UP(c->table_size, bdrv_opt_mem_align(bs->file));

Attachment: pgpz1XKJaGXw3.pgp
Description: PGP signature

Reply via email to