All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] vmdk: Fix error for JSON descriptor file names
Date: Wed, 3 Dec 2014 17:40:09 +0800	[thread overview]
Message-ID: <20141203094009.GC14611@ad.nay.redhat.com> (raw)
In-Reply-To: <1417598601-18537-2-git-send-email-mreitz@redhat.com>

On Wed, 12/03 10:23, Max Reitz wrote:
> If vmdk blindly tries to use path_combine() using bs->file->filename as
> the base file name, this will result in a bad error message for JSON
> file names when calling bdrv_open(). It is better to only try
> bs->file->exact_filename; if that is empty, bs->file->filename will be
> useless for path_combine() and an error should be emitted (containing
> bs->file->filename because bs->file->exact_filename is empty).
> 
> Note that s->create_type does not need to be freed on error because it
> will be freed by the caller (which ultimately is vmdk_open()).
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/vmdk.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 2cbfd3e..fe549c2 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -894,7 +894,14 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf,
>      }
>      s->create_type = g_strdup(ct);
>      s->desc_offset = 0;
> -    ret = vmdk_parse_extents(buf, bs, bs->file->filename, errp);
> +
> +    if (!bs->file->exact_filename[0]) {
> +        error_setg(errp, "Cannot use extents with VMDK descriptor file '%s'",
> +                   bs->file->filename);
> +        ret = -EINVAL;
> +        goto exit;
> +    }
> +    ret = vmdk_parse_extents(buf, bs, bs->file->exact_filename, errp);
>  exit:
>      return ret;
>  }
> -- 
> 1.9.3
> 

Reviewed-by: Fam Zheng <famz@redhat.com>

  reply	other threads:[~2014-12-03  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  9:23 [Qemu-devel] [PATCH 0/2] vmdk: Fix error for JSON descriptor file names Max Reitz
2014-12-03  9:23 ` [Qemu-devel] [PATCH 1/2] " Max Reitz
2014-12-03  9:40   ` Fam Zheng [this message]
2014-12-03 12:44   ` Kevin Wolf
2014-12-03 13:08     ` Max Reitz
2014-12-03  9:23 ` [Qemu-devel] [PATCH 2/2] iotests: Add test for vmdk JSON " Max Reitz
2014-12-03  9:41   ` Fam Zheng

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=20141203094009.GC14611@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.