From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vpc: Add missing error handling in alloc_block
Date: Wed, 23 Nov 2011 12:23:33 +0100 [thread overview]
Message-ID: <4ECCD7B5.6010607@redhat.com> (raw)
In-Reply-To: <CAJSP0QXUBcY-QKQ6cUGNcXKLQFdCCqaVXUhSZqAJ0pEG7aAO3g@mail.gmail.com>
Am 23.11.2011 12:01, schrieb Stefan Hajnoczi:
> On Wed, Nov 23, 2011 at 10:40 AM, Kevin Wolf <kwolf@redhat.com> wrote:
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>> 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
next prev parent reply other threads:[~2011-11-23 11:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 10:40 [Qemu-devel] [PATCH] vpc: Add missing error handling in alloc_block Kevin Wolf
2011-11-23 11:01 ` Stefan Hajnoczi
2011-11-23 11:23 ` Kevin Wolf [this message]
2011-11-25 11:57 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ECCD7B5.6010607@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.