[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v3 04/18] qcow: require image size
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v3 04/18] qcow: require image size to be > 1 for new images |
Date: |
Thu, 09 Feb 2017 12:30:15 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
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 <address@hidden>
Berto