qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v5 09/23] block: Switch BdrvCoGetBlockStatusData


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH v5 09/23] block: Switch BdrvCoGetBlockStatusData to byte-based
Date: Mon, 9 Oct 2017 16:30:05 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 10/09/2017 03:07 PM, Jeff Cody wrote:
> On Tue, Oct 03, 2017 at 09:00:34PM -0500, Eric Blake wrote:
>> We are gradually converting to byte-based interfaces, as they are
>> easier to reason about than sector-based.  Convert another internal
>> type (no semantic change), and rename it to match the corresponding
>> public function rename.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>> Reviewed-by: Fam Zheng <address@hidden>
>> Reviewed-by: John Snow <address@hidden>
>>
>> ---

>>  static void coroutine_fn bdrv_get_block_status_above_co_entry(void *opaque)
>>  {
>> -    BdrvCoGetBlockStatusData *data = opaque;
>> +    BdrvCoBlockStatusData *data = opaque;
>> +    int n;
>>
>>      data->ret = bdrv_co_get_block_status_above(data->bs, data->base,
>>                                                 data->mapping,
>> -                                               data->sector_num,
>> -                                               data->nb_sectors,
>> -                                               data->pnum,
>> +                                               data->offset >> 
>> BDRV_SECTOR_BITS,
>> +                                               data->bytes >> 
>> BDRV_SECTOR_BITS,
>> +                                               &n,
>>                                                 data->file);
>> +    *data->pnum = n * BDRV_SECTOR_SIZE;
> 
> This throws a warning:
> 
>  block/io.c: In function ‘bdrv_get_block_status_above_co_entry’:
>  block/io.c:1995:21: error: ‘n’ may be used uninitialized in this function 
>        [-Werror=maybe-uninitialized] *data->pnum = n * BDRV_SECTOR_SIZE;
> 

Ugh - my curse of compiling development builds with -g instead of -O2,
so I didn't see the warning.  Ideally, it would be nice if all the
various bdrv_*_block_status functions would set *pnum to a sane value on
all exit paths, including errors, but that is not the case in
bdrv_co_get_block_status_above().

> 
> It is fixed a couple patches from now, but it will still break git-bisect.

Indeed.  Will fix on respin, as I have to do a v6 anyways for some minor
rebasing conflict resolution.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]