On Wed 08 Feb 2017 08:29:27 PM CET, Eric Blake wrote: >> The qcow driver refuses to open images which are less than 2 bytes in >> size, but will happily create such images. Add a check in the create >> path to avoid this discrepancy. > > I agree that we have the 2-byte limit: [...] > But why 2 bytes? That's a weird limit from history.
I also don't see what's the point, considering that in qcow_open() bs->total_sectors = header.size / 512; So anything smaller than 512 is an empty image in practice. Maybe it's worth increasing the lower limit in qcow_open(), and/or rejecting to open images with a size that is not multiple of 512. But that would be for a different patch. This one is fine as it is. I think that the condition can be simply (total_size == 0) because it can never have a value between 0 and BDRV_SECTOR_SIZE, but either way Reviewed-by: Alberto Garcia <be...@igalia.com> Berto