[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 3/4] qcow2: Add list of bitmaps to ImageInfoSpeci
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PULL 3/4] qcow2: Add list of bitmaps to ImageInfoSpecificQCow2 |
Date: |
Fri, 20 Mar 2020 17:57:24 +0000 |
On Mon, 11 Feb 2019 at 20:57, Eric Blake <address@hidden> wrote:
>
> From: Andrey Shinkevich <address@hidden>
>
> In the 'Format specific information' section of the 'qemu-img info'
> command output, the supplemental information about existing QCOW2
> bitmaps will be shown, such as a bitmap name, flags and granularity:
Hi; Coverity has just noticed an issue (CID 1421894) with this change:
> diff --git a/block/qcow2.c b/block/qcow2.c
> index bcb80d0270c..65a54c9ac65 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -4387,7 +4387,7 @@ static ImageInfoSpecific
> *qcow2_get_specific_info(BlockDriverState *bs,
> spec_info = g_new(ImageInfoSpecific, 1);
> *spec_info = (ImageInfoSpecific){
> .type = IMAGE_INFO_SPECIFIC_KIND_QCOW2,
> - .u.qcow2.data = g_new(ImageInfoSpecificQCow2, 1),
> + .u.qcow2.data = g_new0(ImageInfoSpecificQCow2, 1),
> };
> if (s->qcow_version == 2) {
> *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
> @@ -4395,6 +4395,13 @@ static ImageInfoSpecific
> *qcow2_get_specific_info(BlockDriverState *bs,
> .refcount_bits = s->refcount_bits,
> };
> } else if (s->qcow_version == 3) {
> + Qcow2BitmapInfoList *bitmaps;
> + bitmaps = qcow2_get_bitmap_info_list(bs, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + qapi_free_ImageInfoSpecific(spec_info);
> + return NULL;
If we take this error-exit codepath, then we never free the
memory allocated by the earlier call to qcrypto_block_get_info().
> + }
> *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
> .compat = g_strdup("1.1"),
> .lazy_refcounts = s->compatible_features &
> @@ -4404,6 +4411,8 @@ static ImageInfoSpecific
> *qcow2_get_specific_info(BlockDriverState *bs,
> QCOW2_INCOMPAT_CORRUPT,
> .has_corrupt = true,
> .refcount_bits = s->refcount_bits,
> + .has_bitmaps = !!bitmaps,
> + .bitmaps = bitmaps,
> };
> } else {
> /* if this assertion fails, this probably means a new version was
> --
> 2.20.1
thanks
-- PMM
- Re: [Qemu-devel] [PULL 3/4] qcow2: Add list of bitmaps to ImageInfoSpecificQCow2,
Peter Maydell <=