From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adpnh-0003VN-SL for qemu-devel@nongnu.org; Wed, 09 Mar 2016 20:54:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adpnh-0003qv-37 for qemu-devel@nongnu.org; Wed, 09 Mar 2016 20:54:05 -0500 Date: Thu, 10 Mar 2016 09:53:56 +0800 From: Fam Zheng Message-ID: <20160310015356.GE23632@ad.usersys.redhat.com> References: <1457425476-32547-1-git-send-email-famz@redhat.com> <1457425476-32547-4-git-send-email-famz@redhat.com> <20160309004344.GA17947@ad.usersys.redhat.com> <20160309095012.GB5205@noname.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160309095012.GB5205@noname.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 3/3] vmdk: Switch to heap arrays for vmdk_parent_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org On Wed, 03/09 10:50, Kevin Wolf wrote: > Am 09.03.2016 um 01:43 hat Fam Zheng geschrieben: > > On Tue, 03/08 16:24, Fam Zheng wrote: > > > Signed-off-by: Fam Zheng > > > --- > > > block/vmdk.c | 17 +++++++++++------ > > > 1 file changed, 11 insertions(+), 6 deletions(-) > > > > > > diff --git a/block/vmdk.c b/block/vmdk.c > > > index c68f456..03be7f0 100644 > > > --- a/block/vmdk.c > > > +++ b/block/vmdk.c > > > @@ -343,15 +343,16 @@ static int vmdk_reopen_prepare(BDRVReopenState *state, > > > static int vmdk_parent_open(BlockDriverState *bs) > > > { > > > char *p_name; > > > - char desc[DESC_SIZE + 1]; > > > + char *desc; > > > BDRVVmdkState *s = bs->opaque; > > > int ret; > > > > > > - desc[DESC_SIZE] = '\0'; > > > + desc = g_malloc0(DESC_SIZE + 1); > > > ret = bdrv_pread(bs->file->bs, s->desc_offset, desc, DESC_SIZE); > > > if (ret < 0) { > > > - return ret; > > > + goto out; > > > } > > > + ret = 0; > > > > Kevin, were you referring to this "ret = 0" in the cover letter? If so, it is > > not useless, because ret was set to DESC_SIZE by bdrv_pread. :) > > Nope, I meant the initialisation in patch 1. You're right. Fam