qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] migration/rdma: Fix uninitialised rdma_return_p


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH] migration/rdma: Fix uninitialised rdma_return_path
Date: Mon, 3 Sep 2018 13:17:53 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

* Thomas Huth (address@hidden) wrote:
> On 2018-08-30 19:36, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <address@hidden>
> > 
> > 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 <address@hidden>
> > Reprorted by: Cornelia Huck <address@hidden>
> > ---
> >  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 <address@hidden>
> 
> 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 / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]