migration/rdma: Fix uninitialised rdma_return_path
PATCH 1/1 migration/rdma: Fix uninitialised rdma_return_path
From: "Dr. David Alan Gilbert" <[email protected]>
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.
Reprorted by: Cornelia Huck <[email protected]>
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
@@ -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 ();
Signature · 1 line
2.17.1
Quoted 9 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Clang correctly errors out moaning that
rdma_return_pathis used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.Fixes 55cc1b5937a8e709e4c102e74b206281073aab82Signed-off-by Dr. David Alan Gilbert <[email protected]>Reprorted by: Cornelia Huck <[email protected]>
"Reported-by"
Quoted 18 lines
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/rdma.c +1
-1@@ -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 ();
Quoted 7 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 6 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Clang correctly errors out moaning that
rdma_return_pathis used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.
Quoted 5 lines
Quoted 3 lines
Fixes 55cc1b5937a8e709e4c102e74b206281073aab82Signed-off-by Dr. David Alan Gilbert <[email protected]>Reprorted by: Cornelia Huck <[email protected]>
"Reported-by"
Oops
Quoted 1 line
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
Dave
Quoted 17 lines
Quoted 17 lines
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/rdma.c +1
-1@@ -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 ;
Quoted 2 lines
migration/rdma.c static void rdma_accept_incoming_migration(void *opaque) · line 4018
Quoted 2 lines
migration/rdma.c +0
-0trace_rdma_start_incoming_migration ();
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 9 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Clang correctly errors out moaning that
rdma_return_pathis used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.Fixes 55cc1b5937a8e709e4c102e74b206281073aab82Signed-off-by Dr. David Alan Gilbert <[email protected]>Reprorted by: Cornelia Huck <[email protected]>
queued
Quoted 18 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Clang correctly errors out moaning that
rdma_return_pathis used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.Fixes 55cc1b5937a8e709e4c102e74b206281073aab82Signed-off-by Dr. David Alan Gilbert <[email protected]>Reprorted by: Cornelia Huck <[email protected]>
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/rdma.c +0
-0
migration/rdma.c static void rdma_accept_incoming_migration(void *opaque) · line 4018
Quoted 8 lines
migration/rdma.c +1
-1@@ -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:
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?
Thomas
Quoted 30 lines · * Thomas Huth ([email protected]) wrote:
Quoted 18 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Clang correctly errors out moaning that
rdma_return_pathis used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.Fixes 55cc1b5937a8e709e4c102e74b206281073aab82Signed-off-by Dr. David Alan Gilbert <[email protected]>Reprorted by: Cornelia Huck <[email protected]>
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/rdma.c +0
-0migration/rdma.c static void rdma_accept_incoming_migration(void *opaque) · line 4018
Quoted 8 lines
migration/rdma.c +1
-1@@ -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:
Quoted 5 lines
Reviewed-by Thomas Huth <[email protected]>But actually, the
g_free(rdma_return_path); at the end of the function is dead code, since it will always be called withrdma_return_path== NULL. Maybe we should rather remove thatg_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
Quoted 1 line
Thomas
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK