qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Peter Lieven <pl@kamp.de>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com,
	jcody@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block/vpc: check that the image has not been truncated
Date: Tue, 22 Oct 2013 07:59:09 +0100	[thread overview]
Message-ID: <5266223D.4080507@redhat.com> (raw)
In-Reply-To: <1382424205-19742-1-git-send-email-pl@kamp.de>

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

On 10/22/2013 07:43 AM, Peter Lieven wrote:
> this adds a check that a dynamic VHD file has not been
> accidently truncated (e.g. during transfer or upload).
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/vpc.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/block/vpc.c b/block/vpc.c
> index 1acc1d4..921364e 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
> @@ -269,6 +269,13 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
>              }
>          }
>  
> +        if (s->free_data_block_offset > bdrv_getlength(bs->file)) {
> +            ret = -EINVAL;
> +            fprintf(stderr, "block-vpc: free_data_block_offset points after"
> +                            "the end of file. the image has been truncated.\n");

Why fprintf() instead of using the errp argument?

Also, s/afterthe/after the/; s/file\. the/file. The/

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-10-22  6:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22  6:43 [Qemu-devel] [PATCH] block/vpc: check that the image has not been truncated Peter Lieven
2013-10-22  6:59 ` Eric Blake [this message]
2013-10-22  7:26   ` Peter Lieven

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=5266223D.4080507@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --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 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).