On 02/04/2015 02:59 PM, Eric Blake wrote:
>> qcow2_alloc_bytes() is a function with insufficient error handling and
>> an unnecessary goto. This patch rewrites it.

>> - redo:
>> +
>>      free_in_cluster = s->cluster_size -
>>          offset_into_cluster(s, s->free_byte_offset);
> 
> Based on [0], free_in_cluster is either s->cluster_size
> (s->free_byte_offset was 0 and we have no tail) or smaller than
> s->cluster_size (s->free_byte_offset was non-zero).

Maybe even worth an assert?

assert(free_in_cluster < s->cluster_size + !s->free_byte_offset);

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to