From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v2] libxl: fix handling of returns in libxl_get_version_info() Date: Fri, 12 Feb 2016 14:09:28 +0100 Message-ID: <1455282568.3148.356.camel@citrix.com> References: <1455276640-3735-1-git-send-email-write.harmandeep@gmail.com> <20160212123145.GA3036@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4456077802952733913==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aUDTb-0006PJ-Nk for xen-devel@lists.xenproject.org; Fri, 12 Feb 2016 13:09:35 +0000 In-Reply-To: <20160212123145.GA3036@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , Harmandeep Kaur Cc: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org --===============4456077802952733913== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-wNPCJxmAcqMDywKtW6JW" --=-wNPCJxmAcqMDywKtW6JW Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-02-12 at 12:31 +0000, Wei Liu wrote: > On Fri, Feb 12, 2016 at 05:00:40PM +0530, Harmandeep Kaur wrote: > >=C2=A0 > > +=C2=A0=C2=A0=C2=A0=C2=A0info->xen_version_major =3D r >> 16; > > +=C2=A0=C2=A0=C2=A0=C2=A0info->xen_version_minor =3D r & 0xFF; > > =C2=A0 > > -=C2=A0=C2=A0=C2=A0=C2=A0xc_version(ctx->xch, XENVER_extraversion, &u.x= en_extra); > > +=C2=A0=C2=A0=C2=A0=C2=A0r =3D xc_version(ctx->xch, XENVER_extraversion= , &u.xen_extra); > > +=C2=A0=C2=A0=C2=A0=C2=A0if ( r < 0 ) goto out; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0info->xen_version_extra =3D libxl__strdup= (NOGC, u.xen_extra); > > =C2=A0 > > -=C2=A0=C2=A0=C2=A0=C2=A0xc_version(ctx->xch, XENVER_compile_info, &u.x= en_cc); > > +=C2=A0=C2=A0=C2=A0=C2=A0r =3D xc_version(ctx->xch, XENVER_compile_info= , &u.xen_cc); > > +=C2=A0=C2=A0=C2=A0=C2=A0if ( r < 0 ) goto out; >=20 > At the beginning of this function it checks if info- > >xen_version_extra > is not NULL. >=20 > You can now get into a state where partial information is cached. > This > is buggy. >=20 Yep, I saw this, and figured out it is not ideal. I thought that, as you say, original code was bad in this respect already, and that we should fix that independently. However... > Not that the original implementation is any better, but if you're > going > to fix it, try not to introduce new bug with your fix. :-) >=20 > I think you can rollback the caching by freeing up any resources > before > returning. >=20 ...you're right, it's probably simple enough to fix both issues, that we should just take the chance. So, Harmandeep, can you take care of this issue Wei is rising as well? Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-wNPCJxmAcqMDywKtW6JW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAla92YgACgkQk4XaBE3IOsQXxQCgnmMj0rsA7raDDvkAwbe4RN93 va0An3KBMHFg327vkhpURcz8Y8BiSPg6 =GKUX -----END PGP SIGNATURE----- --=-wNPCJxmAcqMDywKtW6JW-- --===============4456077802952733913== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============4456077802952733913==--