On Tue 05 Nov 2019 01:47:58 PM CET, Max Reitz wrote:
>> @@ -1347,6 +1347,12 @@ static int coroutine_fn 
>> qcow2_do_open(BlockDriverState *bs, QDict *options,
>>      s->subcluster_size = s->cluster_size / s->subclusters_per_cluster;
>>      s->subcluster_bits = ctz32(s->subcluster_size);
>>  
>> +    if (s->subcluster_size < (1 << MIN_CLUSTER_BITS)) {
>> +        error_setg(errp, "Unsupported subcluster size: %d", 
>> s->subcluster_size);
>> +        ret = -EINVAL;
>> +        goto fail;
>> +    }
>> +
>>      /* Check support for various header values */
>>      if (header.refcount_order > 6) {
>>          error_setg(errp, "Reference count entry width too large; may not "
>
> It feels like this hunk should be part of the patch that added the
> s->subcluster_size assignment.

I don't have a strong opinion, but that patch simply defines the basic
attributes that are used elsewhere in the code, and this is the patch
where the values are checked (for creation and opening).

Berto

Reply via email to