qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>,
	"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: amit.shah@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port
Date: Mon, 12 Sep 2016 14:23:16 -0500	[thread overview]
Message-ID: <cd8b640d-5eb2-13c7-ea1e-2a6a062ec61b@redhat.com> (raw)
In-Reply-To: <20160912191151.GR16124@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]

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" <dgilbert@redhat.com>
>>
>> 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).
> 
> 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 = 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 = NULL;
    SocketAddress *saddr = tcp_build_address(host_port, &err);

    if (!err) {
        socket_start_outgoing_migration(s, saddr, &err);
    }
    error_propagate(errp, err);
}

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-09-12 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 19:03 [Qemu-devel] [PATCH] migration: Fix seg with missing port Dr. David Alan Gilbert (git)
2016-09-12 19:11 ` Daniel P. Berrange
2016-09-12 19:23   ` Eric Blake [this message]
2016-09-15 14:28 ` Paolo Bonzini

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=cd8b640d-5eb2-13c7-ea1e-2a6a062ec61b@redhat.com \
    --to=eblake@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).