qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] vpc: Add missing error handling in alloc_block


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] vpc: Add missing error handling in alloc_block
Date: Wed, 23 Nov 2011 12:23:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

Am 23.11.2011 12:01, schrieb Stefan Hajnoczi:
> On Wed, Nov 23, 2011 at 10:40 AM, Kevin Wolf <address@hidden> wrote:
>> Signed-off-by: Kevin Wolf <address@hidden>
>> ---
>>  block/vpc.c |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/block/vpc.c b/block/vpc.c
>> index 75d7d4a..89a5ee2 100644
>> --- a/block/vpc.c
>> +++ b/block/vpc.c
>> @@ -362,8 +362,11 @@ static int64_t alloc_block(BlockDriverState* bs, 
>> int64_t sector_num)
>>
>>     // Initialize the block's bitmap
>>     memset(bitmap, 0xff, s->bitmap_size);
>> -    bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap,
>> +    ret = bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap,
>>         s->bitmap_size);
>> +    if (ret < 0) {
>> +        return ret;
>> +    }
> 
> I notice that s->pagetable[index] is left modified when the function
> fails.  But this is a larger issue and could be addressed in a later
> patch which also looks at the other failure cases in this function.

Error handling in vpc needs some work anyway. For example, almost all
places return -1 instead of the real error number. Probably even the
order of operations is unsafe, didn't check that yet.

Kevin



reply via email to

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