[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 3/7] qcow2: Prevent allocating compressed clu
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v2 3/7] qcow2: Prevent allocating compressed clusters at offset 0 |
Date: |
Fri, 03 Nov 2017 21:22:39 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Fri 03 Nov 2017 05:27:59 PM CET, Max Reitz wrote:
>> + if (new_cluster == 0) {
>> + qcow2_signal_corruption(bs, true, -1, -1, "Preventing
>> invalid "
>> + "allocation of compressed cluster "
>> + "at offset 0");
>> + return -EIO;
>> + }
>> +
>> if (!offset || ROUND_UP(offset, s->cluster_size) !=
>> new_cluster) {
>> offset = new_cluster;
>> free_in_cluster = s->cluster_size;
>> @@ -1090,7 +1097,6 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int
>> size)
>> }
>> }
>>
>> - assert(offset);
>
> I don't think this assert() was meant as a protection against offset
> being 0. :-)
After the new check offset is now guaranteed to be 0, so what's the
point of keeping the assert() ?
Berto
[Qemu-block] [PATCH v2 2/7] qcow2: Prevent allocating L2 tables at offset 0, Alberto Garcia, 2017/11/03
[Qemu-block] [PATCH v2 6/7] qcow2: Add iotest for an empty refcount table, Alberto Garcia, 2017/11/03
[Qemu-block] [PATCH v2 1/7] qcow2: Prevent allocating refcount blocks at offset 0, Alberto Garcia, 2017/11/03
[Qemu-block] [PATCH v2 5/7] qcow2: Add iotest for an image with header.refcount_table_offset == 0, Alberto Garcia, 2017/11/03
[Qemu-block] [PATCH v2 4/7] qcow2: Don't open images with header.refcount_table_clusters == 0, Alberto Garcia, 2017/11/03