From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH for-4.6 02/13] libxl: properly clean up array in libxl_list_cpupool failure path Date: Thu, 23 Jul 2015 16:29:54 +0200 Message-ID: <1437661794.5036.99.camel@citrix.com> References: <1437638354-14216-1-git-send-email-wei.liu2@citrix.com> <1437638354-14216-3-git-send-email-wei.liu2@citrix.com> <1437643322.19412.64.camel@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2224334396989046722==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIHVa-0006Kc-6x for xen-devel@lists.xenproject.org; Thu, 23 Jul 2015 14:30:02 +0000 In-Reply-To: <1437643322.19412.64.camel@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: Ian Campbell Cc: Xen-devel , Wei Liu , Ian Jackson List-Id: xen-devel@lists.xenproject.org --===============2224334396989046722== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-V1TCPEPZODM5B6KwpLjA" --=-V1TCPEPZODM5B6KwpLjA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2015-07-23 at 10:22 +0100, Ian Campbell wrote: > On Thu, 2015-07-23 at 08:59 +0100, Wei Liu wrote: > > There is change of behaviour. Previously if memory allocation fails=20 > > the > > said function returns NULL. Now memory allocation failure is fatal.=20 > > This > > is in line with how we deal with memory allocation failure in other > > places in libxl though. >=20 > I think this function would benefit from making the out: label be the > error path and the success case just a return ptr (just before the > label). >=20 > Then your error handling for cpupool_info would become > libxl_cpupoolinfo_dispose(&info); > if (errno !=3D ENOENT) goto out; > break; >=20 > and the "if (failed)" block would be at the out label (without the > iff). >=20 I was about to give my Reviewed-by, but yes, I like Ian's suggestion too. In any case, apart from how error handling is done, I think this patch is fine, as far as dealing with cpupools goes. Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-V1TCPEPZODM5B6KwpLjA 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 v2 iEYEABECAAYFAlWw+mIACgkQk4XaBE3IOsTEfQCaAv51BcR9Pco3NU0nzl8QHW/7 IsAAniAvjjkFKlz6MkHg891qyjXHaW2p =WMXT -----END PGP SIGNATURE----- --=-V1TCPEPZODM5B6KwpLjA-- --===============2224334396989046722== 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 --===============2224334396989046722==--