All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info()
@ 2015-12-10  9:55 Denis V. Lunev
  2015-12-10 15:08 ` Eric Blake
  2015-12-10 15:15 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Denis V. Lunev @ 2015-12-10  9:55 UTC (permalink / raw)
  Cc: Kevin Wolf, Denis V. Lunev, Max Reitz, qemu-devel, Roman Kagan

s->qcow_version is always set to 2 or 3. Let's assert if this is wrong.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Roman Kagan <rkagan@virtuozzo.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
---
 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);
     }
 
     return spec_info;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info()
  2015-12-10  9:55 [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info() Denis V. Lunev
@ 2015-12-10 15:08 ` Eric Blake
  2015-12-10 15:15 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2015-12-10 15:08 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Kevin Wolf, Roman Kagan, qemu-devel, qemu block, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]

[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 <den@openvz.org>
> CC: Roman Kagan <rkagan@virtuozzo.com>
> CC: Max Reitz <mreitz@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> ---
>  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 <eblake@redhat.com>

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info()
  2015-12-10  9:55 [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info() Denis V. Lunev
  2015-12-10 15:08 ` Eric Blake
@ 2015-12-10 15:15 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2015-12-10 15:15 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Max Reitz, qemu-devel, Roman Kagan

Am 10.12.2015 um 10:55 hat Denis V. Lunev geschrieben:
> s->qcow_version is always set to 2 or 3. Let's assert if this is wrong.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Roman Kagan <rkagan@virtuozzo.com>
> CC: Max Reitz <mreitz@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>

Thanks, applied to block-next.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-10 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10  9:55 [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info() Denis V. Lunev
2015-12-10 15:08 ` Eric Blake
2015-12-10 15:15 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.