From 19a420a05276585b9ccc1b21b4a6151fa8d0c3e9 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 28 Jun 2018 15:29:41 -0700 Subject: [PATCH] btl/tcp: fix hash map usage Fix two facepalms: 1. The "uint32" in the hash map functions refer to the *key* size, not the *value* size. The values are always 64 bits. 2. Pass the straight value to the "set" functions -- not the pointer to the value. Signed-off-by: Jeff Squyres (cherry picked from commit 57bc657e7ffbd199bd856b9bed77bf9b043f7b9d) --- opal/mca/btl/tcp/btl_tcp_proc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/tcp/btl_tcp_proc.c b/opal/mca/btl/tcp/btl_tcp_proc.c index 92f8c3475e2..54802f3883d 100644 --- a/opal/mca/btl/tcp/btl_tcp_proc.c +++ b/opal/mca/btl/tcp/btl_tcp_proc.c @@ -294,7 +294,7 @@ static mca_btl_tcp_interface_t** mca_btl_tcp_retrieve_local_interfaces(mca_btl_t */ for( idx = opal_ifbegin(); idx >= 0; idx = opal_ifnext (idx) ) { int kindex; - uint32_t index; + uint64_t index; bool skip = false; opal_ifindextoaddr (idx, (struct sockaddr*) &local_addr, sizeof (local_addr)); @@ -348,7 +348,7 @@ static mca_btl_tcp_interface_t** mca_btl_tcp_retrieve_local_interfaces(mca_btl_t /* create entry for this kernel index previously not seen */ if (OPAL_SUCCESS != rc) { index = proc_data->num_local_interfaces++; - opal_hash_table_set_value_uint32(&proc_data->local_kindex_to_index, kindex, &index); + opal_hash_table_set_value_uint32(&proc_data->local_kindex_to_index, kindex, (void**) index); if( proc_data->num_local_interfaces == proc_data->max_local_interfaces ) { proc_data->max_local_interfaces <<= 1; @@ -468,7 +468,7 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc, for( i = 0; i < btl_proc->proc_addr_count; i++ ) { - uint32_t index; + uint64_t index; mca_btl_tcp_addr_t* endpoint_addr = btl_proc->proc_addrs + i; @@ -478,7 +478,7 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc, if (OPAL_SUCCESS != rc) { index = proc_data->num_peer_interfaces++; - opal_hash_table_set_value_uint32(&proc_data->peer_kindex_to_index, endpoint_addr->addr_ifkindex, &index); + opal_hash_table_set_value_uint32(&proc_data->peer_kindex_to_index, endpoint_addr->addr_ifkindex, (void**) index); if( proc_data->num_peer_interfaces == max_peer_interfaces ) { max_peer_interfaces <<= 1; peer_interfaces = (mca_btl_tcp_interface_t**)realloc( peer_interfaces,