[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH for 2.10 06/35] qcow2: remove inc
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH for 2.10 06/35] qcow2: remove inconsistent check |
Date: |
Tue, 25 Jul 2017 17:36:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 24/07/2017 20:42, Eric Blake wrote:
> 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.
I think it's even better to initialize bitmap_table to NULL in
free_bitmap_clusters, as all other callers do.
Paolo
- Re: [Qemu-trivial] [PATCH for 2.10 02/35] loader: check get_image_size() return value, (continued)
- [Qemu-trivial] [PATCH for 2.10 03/35] thunk: check nb_fields is valid before continuing, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 05/35] nbd: fix memory leak in nbd_opt_go(), Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 06/35] qcow2: remove inconsistent check, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 08/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 09/35] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24