[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH for 2.10 06/35] qcow2: remove inconsistent check
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH for 2.10 06/35] qcow2: remove inconsistent check |
Date: |
Mon, 24 Jul 2017 13:42:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/24/2017 01:27 PM, Philippe Mathieu-Daudé wrote:
> This is equivalent to assert(russian roulette) so better remove it.
>
> block/qcow2-bitmap.c:259:29: warning: The left operand of '==' is a garbage
> value
> assert(bitmap_table == NULL);
> ~~~~~~~~~~~~ ^
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> block/qcow2-bitmap.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
> index 3e8735a20d..fe72df5057 100644
> --- a/block/qcow2-bitmap.c
> +++ b/block/qcow2-bitmap.c
> @@ -254,7 +254,6 @@ static int free_bitmap_clusters(BlockDriverState *bs,
> Qcow2BitmapTable *tb)
>
> ret = bitmap_table_load(bs, tb, &bitmap_table);
> if (ret < 0) {
> - assert(bitmap_table == NULL);
Rather, we should fix bitmap_table_load() to ensure that bitmap_table is
always assigned, even on error.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature