qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vpc: Add missing error handling in alloc_block
Date: Fri, 25 Nov 2011 12:57:39 +0100	[thread overview]
Message-ID: <4ECF82B3.5090705@suse.de> (raw)
In-Reply-To: <4ECCD7B5.6010607@redhat.com>

Am 23.11.2011 12:23, schrieb Kevin Wolf:
> 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.

As a note, as part of QEMU Test Day(s) I tested VHD images (cf. Wiki) -
booting, installing software, etc. and haven't encountered any problem.
Doesn't mean it's entirely safe though, obviously.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

      reply	other threads:[~2011-11-25 11:58 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
2011-11-25 11:57     ` Andreas Färber [this message]

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=4ECF82B3.5090705@suse.de \
    --to=afaerber@suse.de \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).