From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, cohuck@redhat.com,
jemmy858585@gmail.com
Subject: Re: [Qemu-devel] [PATCH] migration/rdma: Fix uninitialised rdma_return_path
Date: Mon, 3 Sep 2018 13:17:53 +0100 [thread overview]
Message-ID: <20180903121752.GC2414@work-vm> (raw)
In-Reply-To: <90c91534-ea52-42a8-0a01-5c8e5898b6d0@redhat.com>
* Thomas Huth (thuth@redhat.com) wrote:
> On 2018-08-30 19:36, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Clang correctly errors out moaning that rdma_return_path
> > is used uninitialised in the earlier error paths.
> > Make it NULL so that the error path ignores it.
> >
> > Fixes: 55cc1b5937a8e709e4c102e74b206281073aab82
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > Reprorted by: Cornelia Huck <cohuck@redhat.com>
> > ---
> > migration/rdma.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/migration/rdma.c b/migration/rdma.c
> > index ae07515e83..9b2e7e10aa 100644
> > --- a/migration/rdma.c
> > +++ b/migration/rdma.c
> > @@ -4012,7 +4012,7 @@ static void rdma_accept_incoming_migration(void *opaque)
> > void rdma_start_incoming_migration(const char *host_port, Error **errp)
> > {
> > int ret;
> > - RDMAContext *rdma, *rdma_return_path;
> > + RDMAContext *rdma, *rdma_return_path = NULL;
> > Error *local_err = NULL;
> >
> > trace_rdma_start_incoming_migration();
>
> This will silence the error from clang for sure, so:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
> But actually, the g_free(rdma_return_path); at the end of the function
> is dead code, since it will always be called with rdma_return_path ==
> NULL. Maybe we should rather remove that g_free() instead?
It's nice keeping the rdma/rdma_return_path semetric there so that if
we add other code into it the err path still cleans up.
Dave
> Thomas
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2018-09-03 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 17:36 [Qemu-devel] [PATCH] migration/rdma: Fix uninitialised rdma_return_path Dr. David Alan Gilbert (git)
2018-08-31 0:17 ` Philippe Mathieu-Daudé
2018-08-31 9:37 ` Dr. David Alan Gilbert
2018-08-31 8:20 ` Juan Quintela
2018-09-03 7:40 ` Thomas Huth
2018-09-03 12:17 ` Dr. David Alan Gilbert [this message]
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=20180903121752.GC2414@work-vm \
--to=dgilbert@redhat.com \
--cc=cohuck@redhat.com \
--cc=jemmy858585@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@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).