Skip to content

Commit

Permalink
migration/rdma: Drop dead qemu_rdma_data_init() code for !@host_port
Browse files Browse the repository at this point in the history
qemu_rdma_data_init() neglects to set an Error when it fails because
@host_port is null.  Fortunately, no caller passes null, so this is
merely a latent bug.  Drop the flawed code handling null argument.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230928132019.2544702-23-armbru@redhat.com>
  • Loading branch information
Markus Armbruster authored and Juan Quintela committed Oct 11, 2023
1 parent f35c0d9 commit d63f401
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions migration/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2767,25 +2767,22 @@ static RDMAContext *qemu_rdma_data_init(const char *host_port, Error **errp)
RDMAContext *rdma = NULL;
InetSocketAddress *addr;

if (host_port) {
rdma = g_new0(RDMAContext, 1);
rdma->current_index = -1;
rdma->current_chunk = -1;

addr = g_new(InetSocketAddress, 1);
if (!inet_parse(addr, host_port, NULL)) {
rdma->port = atoi(addr->port);
rdma->host = g_strdup(addr->host);
rdma->host_port = g_strdup(host_port);
} else {
ERROR(errp, "bad RDMA migration address '%s'", host_port);
g_free(rdma);
rdma = NULL;
}

qapi_free_InetSocketAddress(addr);
rdma = g_new0(RDMAContext, 1);
rdma->current_index = -1;
rdma->current_chunk = -1;

addr = g_new(InetSocketAddress, 1);
if (!inet_parse(addr, host_port, NULL)) {
rdma->port = atoi(addr->port);
rdma->host = g_strdup(addr->host);
rdma->host_port = g_strdup(host_port);
} else {
ERROR(errp, "bad RDMA migration address '%s'", host_port);
g_free(rdma);
rdma = NULL;
}

qapi_free_InetSocketAddress(addr);
return rdma;
}

Expand Down

0 comments on commit d63f401

Please sign in to comment.