[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 3/7] qcow2: Check L1 table parameters in qcow2_e
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH 3/7] qcow2: Check L1 table parameters in qcow2_expand_zero_clusters() |
Date: |
Tue, 06 Mar 2018 16:01:02 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Tue 06 Mar 2018 03:54:26 PM CET, Kevin Wolf wrote:
>> @@ -2092,11 +2092,18 @@ int qcow2_expand_zero_clusters(BlockDriverState *bs,
>> }
>>
>> for (i = 0; i < s->nb_snapshots; i++) {
>> - int l1_sectors = DIV_ROUND_UP(s->snapshots[i].l1_size *
>> - sizeof(uint64_t), BDRV_SECTOR_SIZE);
>> + int l1_size2;
>> + uint64_t *new_l1_table;
>>
>> - uint64_t *new_l1_table =
>> - g_try_realloc(l1_table, l1_sectors * BDRV_SECTOR_SIZE);
>> + ret = qcow2_validate_table(bs, s->snapshots[i].l1_table_offset,
>> + s->snapshots[i].l1_size,
>> sizeof(uint64_t),
>> + QCOW_MAX_L1_SIZE, "", NULL);
>> + if (ret < 0) {
>> + return ret;
>
> Shouldn't this be goto fail?
You're right, this is a loop, and l1_table could have been initialized
in previous iterations.
I'll send a corrected version with this change, but first I'll wait a
bit in case you see anything else in the series.
Berto
- Re: [Qemu-block] [PATCH 4/7] qcow2: Check snapshot L1 tables in qcow2_check_metadata_overlap(), (continued)
Re: [Qemu-block] [PATCH 0/7] Add checks for corruption in the snapshot table, Kevin Wolf, 2018/03/06