qcow2: insert assert into qcow2_get_specific_info()
PATCH 1/1 qcow2: insert assert into qcow2_get_specific_info()
s->qcow_version is always set to 2 or 3. Let's assert if this is wrong.
Signed-off-by Denis V. Lunev <[email protected]>
CC Roman Kagan <[email protected]>
CC Max Reitz <[email protected]>
CC Kevin Wolf <[email protected]>
--- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+)
block/qcow2.c +4 -0
@@ -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;
Signature · 1 line
2.1.4
[adding qemu-block in cc, per MAINTAINERS]
Quoted 15 lines · Denis V. Lunev
s->qcow_versionis always set to 2 or 3. Let's assert if this is wrong.Signed-off-by Denis V. Lunev <[email protected]>CC Roman Kagan <[email protected]>CC Max Reitz <[email protected]>CC Kevin Wolf <[email protected]>--- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+)block/qcow2.c +0
-0
block/qcow2.c static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs) · line 2763
Quoted 7 lines
block/qcow2.c +4
-0@@ -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 <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Kevin Wolf
AppliedAm 10.12.2015 um 10:55 hat Denis V. Lunev geschrieben:
Quoted 6 lines
s->qcow_versionis always set to 2 or 3. Let's assert if this is wrong.Signed-off-by Denis V. Lunev <[email protected]>CC Roman Kagan <[email protected]>CC Max Reitz <[email protected]>CC Kevin Wolf <[email protected]>
Thanks, applied to block-next.
Kevin