From: Jeff Cody <jcody@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: "Benoît Canet" <benoit.canet@irqsave.net>,
kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 1/3] block: resize backing file image during offline commit, if necessary
Date: Thu, 23 Jan 2014 17:14:17 -0500 [thread overview]
Message-ID: <20140123221417.GD13722@localhost.localdomain> (raw)
In-Reply-To: <52E192B0.1030804@redhat.com>
On Thu, Jan 23, 2014 at 03:07:44PM -0700, Eric Blake wrote:
> On 01/23/2014 03:00 PM, Benoît Canet wrote:
> > Le Thursday 23 Jan 2014 à 16:48:55 (-0500), Jeff Cody a écrit :
> >> Currently, if an image file is logically larger than its backing file,
> >> commiting it via 'qemu-img commit' will fail.
>
> s/commiting/committing/
>
I could respin, or Kevin / Stefan could fix this up whenever it is
applied to their branches.
>
> >> + uint8_t *buf = NULL;
> >
> > Why assign NULL to buf ? Is it related to the rest of the patch ?
> >
> > Reviewed-by: Benoit Canet <benoit@irqsave.net>
> >
> >> char filename[PATH_MAX];
> >>
> >> if (!drv)
> >> @@ -1904,7 +1904,24 @@ int bdrv_commit(BlockDriverState *bs)
> >> }
> >> }
> >>
> >> - total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
> >> + length = bdrv_getlength(bs);
> >> + backing_length = bdrv_getlength(bs->backing_hd);
> >> +
> >> + if (length < 0 || backing_length < 0) {
> >> + goto ro_cleanup;
>
> Because this goto now reaches the ro_cleanup label with buf
> uninitialized, if we don't assign NULL originally.
>
Yup, exactly.
> >> + total_sectors = length >> BDRV_SECTOR_BITS;
> >> buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE);
>
> The old code only ever reached ro_cleanup after assigning buf, and
> ro_cleanup blindly frees buf.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
next prev parent reply other threads:[~2014-01-23 22:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 21:48 [Qemu-devel] [PATCH v3 0/3] block: commits of snapshots larger than backing files Jeff Cody
2014-01-23 21:48 ` [Qemu-devel] [PATCH v3 1/3] block: resize backing file image during offline commit, if necessary Jeff Cody
2014-01-23 22:00 ` Benoît Canet
2014-01-23 22:07 ` Eric Blake
2014-01-23 22:14 ` Jeff Cody [this message]
2014-01-23 22:35 ` Benoît Canet
2014-01-23 21:48 ` [Qemu-devel] [PATCH v3 2/3] block: resize backing image during active layer commit, if needed Jeff Cody
2014-01-23 22:05 ` Benoît Canet
2014-01-23 22:18 ` Jeff Cody
2014-01-23 22:05 ` Eric Blake
2014-01-23 21:48 ` [Qemu-devel] [PATCH v3 3/3] block: update block commit documentation regarding image truncation Jeff Cody
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=20140123221417.GD13722@localhost.localdomain \
--to=jcody@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@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.