qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/7] qcow2: Prevent allocating compressed clu


From: Alberto Garcia
Subject: Re: [Qemu-devel] [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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]