Skip to contentSkip to conversation

migration/rdma: Fix uninitialised rdma_return_path

PATCH In review Dr. David Alan Gilbert (git) 4 participants 6 messages Aug 30, 2018 – Sep 3, 2018

lore
Share & tools
lore
#0 lore raw

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.

Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

Reprorted by: Cornelia Huck <[email protected]>

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
index ae07515e83..9b2e7e10aa 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dr. David Alan Gilbert (git)

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.

Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

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
index ae07515e83..9b2e7e10aa 100644
@@ -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();
#2 lore raw
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_path is used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.

Quoted 5 lines
Quoted 3 lines
Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

Reprorted by: Cornelia Huck <[email protected]>

"Reported-by"

Oops

Quoted 1 line

Thanks,

Dave

Quoted 17 lines
Quoted 17 lines
---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
index ae07515e83..9b2e7e10aa 100644
@@ -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 -0
     trace_rdma_start_incoming_migration();

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by on v1 1/1
#3 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 9 lines · Dr. David Alan Gilbert (git)

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.

Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

Reprorted by: Cornelia Huck <[email protected]>

queued

Reviewed-by on v1 1/1
#4 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 18 lines · Dr. David Alan Gilbert (git)

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.

Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

Reprorted by: Cornelia Huck <[email protected]>

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index ae07515e83..9b2e7e10aa 100644

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

#5 lore raw
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_path is used uninitialised in the earlier error paths. Make it NULL so that the error path ignores it.

Fixes 55cc1b5937a8e709e4c102e74b206281073aab82

Reprorted by: Cornelia Huck <[email protected]>

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index ae07515e83..9b2e7e10aa 100644

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:

Quoted 5 lines

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

Quoted 1 line

Thomas

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK