qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specifi


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info()
Date: Thu, 10 Dec 2015 08:08:54 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

[adding qemu-block in cc, per MAINTAINERS]

On 12/10/2015 02:55 AM, Denis V. Lunev wrote:
> s->qcow_version is always set to 2 or 3. Let's assert if this is wrong.
> 
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Roman Kagan <address@hidden>
> CC: Max Reitz <address@hidden>
> CC: Kevin Wolf <address@hidden>
> ---
>  block/qcow2.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 88f56c8..b285014 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2757,6 +2757,10 @@ static ImageInfoSpecific 
> *qcow2_get_specific_info(BlockDriverState *bs)
>              .has_corrupt        = true,
>              .refcount_bits      = s->refcount_bits,
>          };
> +    } else {
> +        /* if this assertion fails, this probably means a new version was
> +         * added without having it covered here */
> +        assert(false);

Only covers us if we don't turn on NDEBUG during compile; but then
again, lots of spots in the code base assume assert() will never be
crippled.

Reviewed-by: Eric Blake <address@hidden>

-- 
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

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