From ef97d608c7f069331d8141d1d59df715f4a3beaf Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Sat, 18 Jan 2020 20:09:26 +0100 Subject: qcow2: Don't round the L1 table allocation up to the sector size The L1 table is read from disk using the byte-based bdrv_pread() and is never accessed beyond its last element, so there's no need to allocate more memory than that. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Message-id: b2e27214ec7b03a585931bcf383ee1ac3a641a10.1579374329.git.berto@igalia.com Signed-off-by: Max Reitz --- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/qcow2.c') diff --git a/block/qcow2.c b/block/qcow2.c index e29fc07..83db013 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1491,7 +1491,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, if (s->l1_size > 0) { s->l1_table = qemu_try_blockalign(bs->file->bs, - ROUND_UP(s->l1_size * sizeof(uint64_t), 512)); + s->l1_size * sizeof(uint64_t)); if (s->l1_table == NULL) { error_setg(errp, "Could not allocate L1 table"); ret = -ENOMEM; -- cgit v1.1