From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjWpB-0000wL-Nf for qemu-devel@nongnu.org; Mon, 12 Sep 2016 15:23:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjWp5-0007vs-Oi for qemu-devel@nongnu.org; Mon, 12 Sep 2016 15:23:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjWp5-0007vU-Fo for qemu-devel@nongnu.org; Mon, 12 Sep 2016 15:23:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2905543A37 for ; Mon, 12 Sep 2016 19:23:18 +0000 (UTC) References: <1473707034-31147-1-git-send-email-dgilbert@redhat.com> <20160912191151.GR16124@redhat.com> From: Eric Blake Message-ID: Date: Mon, 12 Sep 2016 14:23:16 -0500 MIME-Version: 1.0 In-Reply-To: <20160912191151.GR16124@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Fmimlqgq6T8G6ROS1iTQcxAKjhbMxmgwQ" Subject: Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , "Dr. David Alan Gilbert (git)" Cc: amit.shah@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Fmimlqgq6T8G6ROS1iTQcxAKjhbMxmgwQ From: Eric Blake To: "Daniel P. Berrange" , "Dr. David Alan Gilbert (git)" Cc: amit.shah@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com Message-ID: Subject: Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port References: <1473707034-31147-1-git-send-email-dgilbert@redhat.com> <20160912191151.GR16124@redhat.com> In-Reply-To: <20160912191151.GR16124@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/12/2016 02:11 PM, Daniel P. Berrange wrote: > On Mon, Sep 12, 2016 at 08:03:54PM +0100, Dr. David Alan Gilbert (git) = wrote: >> From: "Dr. David Alan Gilbert" >> >> The command : >> migrate tcp:localhost: >> >> currently segs; fix it so it now says: >> >> error parsing address 'localhost:' >> >> and the same for -incoming. >> >> (We know that errp is non-null; callers use a local_err). >=20 > I'd still be more comfortable with us using a local Error > object here, as it illustrates best practice and protects > against future accidents. Concur. Having an example contrary to best practice makes it far too easy for that example to be copied somewhere where it will later break. >> +++ b/migration/socket.c >> @@ -113,7 +113,9 @@ void tcp_start_outgoing_migration(MigrationState *= s, >> Error **errp) >> { >> SocketAddress *saddr =3D tcp_build_address(host_port, errp); >> - socket_start_outgoing_migration(s, saddr, errp); >> + if (!*errp) { >> + socket_start_outgoing_migration(s, saddr, errp); >> + } Since we make a decision about code flow based on whether an earlier error occurred, this SHOULD be: { Error *err =3D NULL; SocketAddress *saddr =3D tcp_build_address(host_port, &err); if (!err) { socket_start_outgoing_migration(s, saddr, &err); } error_propagate(errp, err); } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Fmimlqgq6T8G6ROS1iTQcxAKjhbMxmgwQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX1wCkAAoJEKeha0olJ0NqOJ8H/iGTmc8EHETucK9epqQX+NQU 9CyTsQIuk66NEo6pMuQ/8vECC3DttQR5/Du18UcYBjtSTrCCSBIrA0mb5ypjs3ZK pXmNdDiz9TAF/XaC4JxnUSM0iEt9CE4Uz38pZlyCTvvcTsGpu/NYjeqt7VC2+50v fBsbFZFSMAGPwstCJthLn+urqbVCE84iDJuYt+fiKS3CnYr/2DCSmSCR1xsLb3w/ Nxeit/1LRDA0ghqQ7XP8bP7jtyZBg1cxPw8klRu82ec4OudbKnUBD888Dt1hMYru HDlx6I5fx9jTBLVeSTxai4LO+38NeXuwChmOkCqavtnW3yAikerPwjLrDNd/gEs= =o0Fj -----END PGP SIGNATURE----- --Fmimlqgq6T8G6ROS1iTQcxAKjhbMxmgwQ--