Skip to content

Commit 8979bfe

Browse files
author
Ralph Castain
committed
Silence Coverity warnings
Signed-off-by: Ralph Castain <[email protected]>
1 parent fc11c37 commit 8979bfe

File tree

3 files changed

+79
-69
lines changed

3 files changed

+79
-69
lines changed

orte/mca/oob/tcp/oob_tcp_component.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,10 @@ static void component_shutdown(void)
730730
while (OPAL_SUCCESS == rc) {
731731
if (NULL != peer) {
732732
OBJ_RELEASE(peer);
733-
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, key, NULL);
733+
rc = opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, key, NULL);
734+
if (OPAL_SUCCESS != rc) {
735+
ORTE_ERROR_LOG(rc);
736+
}
734737
}
735738
rc = opal_hash_table_get_next_key_uint64(&mca_oob_tcp_component.peers, &key,
736739
(void **) &peer, node, &node);
@@ -968,7 +971,10 @@ static int component_set_addr(orte_process_name_t *peer,
968971
if (ORTE_SUCCESS != (rc = parse_uri(af_family, host, ports, (struct sockaddr_storage*) &(maddr->addr)))) {
969972
ORTE_ERROR_LOG(rc);
970973
OBJ_RELEASE(maddr);
971-
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, ui64, NULL);
974+
rc = opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, ui64, NULL);
975+
if (ORTE_SUCCESS != rc) {
976+
ORTE_ERROR_LOG(rc);
977+
}
972978
OBJ_RELEASE(pr);
973979
return ORTE_ERR_TAKE_NEXT_OPTION;
974980
}

orte/mca/rml/ofi/rml_ofi_component.c

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static bool ofi_desired = false;
8787
bool user_override(void)
8888
{
8989
if( 0 == strcmp(initial_ofi_transports_supported, ofi_transports_supported ) )
90-
return false;
90+
return false;
9191
else
9292
return true;
9393
}
@@ -939,48 +939,51 @@ int get_ofi_prov_id( opal_list_t *attributes)
939939
char *provider = NULL, *transport = NULL;
940940
char *ethernet="sockets", *fabric="psm2";
941941
struct fi_info *cur_fi;
942-
char *comp_attrib = NULL;
943-
char **comps;
944-
int i;
942+
char *comp_attrib = NULL;
943+
char **comps;
944+
int i;
945945

946946
/* check the list of attributes in below order
947947
* Attribute should have ORTE_RML_TRANSPORT_ATTRIB key
948948
* with values "ethernet" or "fabric". "fabric" is higher priority.
949949
* (or) ORTE_RML_OFI_PROV_NAME key with values "socket" or "OPA"
950950
* if both above attributes are missing return failure
951951
*/
952-
//if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_ATTRIB, (void**)&transport, OPAL_STRING) ) {
953-
954-
if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_TYPE, (void**)&comp_attrib, OPAL_STRING) &&
955-
NULL != comp_attrib) {
956-
comps = opal_argv_split(comp_attrib, ',');
957-
for (i=0; NULL != comps[i] && choice_made == false ; i++) {
958-
if (NULL != strstr(ofi_transports_supported, comps[i])) {
959-
if (0 == strcmp( comps[i], "ethernet")) {
960-
opal_output_verbose(20,orte_rml_base_framework.framework_output,
961-
"%s - Opening conduit using OFI ethernet/sockets provider",
962-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
963-
opal_argv_free(comps);
964-
provider = ethernet;
965-
choose_fabric = false;
966-
choice_made = false; /* continue to see if fabric is requested */
967-
} else if ( 0 == strcmp ( comps[i], "fabric")) {
968-
opal_output_verbose(20,orte_rml_base_framework.framework_output,
969-
"%s - Opening conduit using OFI fabric provider",
970-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
971-
opal_argv_free(comps);
972-
choose_fabric = true;
973-
provider = NULL;
974-
choice_made = true; /* fabric is highest priority so don't check for anymore */
975-
}
976-
}
952+
//if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_ATTRIB, (void**)&transport, OPAL_STRING) ) {
953+
954+
if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_TYPE, (void**)&comp_attrib, OPAL_STRING) &&
955+
NULL != comp_attrib) {
956+
comps = opal_argv_split(comp_attrib, ',');
957+
for (i=0; NULL != comps[i] && choice_made == false ; i++) {
958+
if (NULL != strstr(ofi_transports_supported, comps[i])) {
959+
if (0 == strcmp( comps[i], "ethernet")) {
960+
opal_output_verbose(20,orte_rml_base_framework.framework_output,
961+
"%s - Opening conduit using OFI ethernet/sockets provider",
962+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
963+
opal_argv_free(comps);
964+
provider = ethernet;
965+
choose_fabric = false;
966+
choice_made = false; /* continue to see if fabric is requested */
967+
} else if ( 0 == strcmp ( comps[i], "fabric")) {
968+
opal_output_verbose(20,orte_rml_base_framework.framework_output,
969+
"%s - Opening conduit using OFI fabric provider",
970+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
971+
opal_argv_free(comps);
972+
choose_fabric = true;
973+
provider = NULL;
974+
choice_made = true; /* fabric is highest priority so don't check for anymore */
975+
}
976+
}
977977
}
978978
}
979979
/* if from the transport we don't know which provider we want, then check for the ORTE_RML_OFI_PROV_NAME_ATTRIB */
980980
if ( NULL == provider) {
981-
orte_get_attribute(attributes, ORTE_RML_PROVIDER_ATTRIB, (void**)&provider, OPAL_STRING);
981+
if (!orte_get_attribute(attributes, ORTE_RML_PROVIDER_ATTRIB, (void**)&provider, OPAL_STRING)) {
982+
/* ensure it remains NULL */
983+
provider = NULL;
984+
}
982985
}
983-
/* either ethernet-sockets or specific is requested. Proceed to choose that provider */
986+
/* either ethernet-sockets or specific is requested. Proceed to choose that provider */
984987
if ( NULL != provider) {
985988
// loop the orte_rml_ofi.ofi_provs[] and find the provider name that matches
986989
for ( prov_num = 0; prov_num < orte_rml_ofi.ofi_prov_open_num && ofi_prov_id == RML_OFI_PROV_ID_INVALID ; prov_num++ ) {
@@ -990,24 +993,24 @@ int get_ofi_prov_id( opal_list_t *attributes)
990993
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),provider,cur_fi->fabric_attr->prov_name);
991994
if ( strcmp(provider,cur_fi->fabric_attr->prov_name) == 0) {
992995
ofi_prov_id = prov_num;
993-
opal_output_verbose(20,orte_rml_base_framework.framework_output,
994-
"%s - Choosing provider %s",
996+
opal_output_verbose(20,orte_rml_base_framework.framework_output,
997+
"%s - Choosing provider %s",
995998
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
996-
cur_fi->fabric_attr->prov_name);
997-
}
998-
}
999-
} else if ( choose_fabric ) {
1000-
// "fabric" is requested, choose the first fabric(non-ethernet) provider
1001-
for ( prov_num = 0; prov_num < orte_rml_ofi.ofi_prov_open_num && ofi_prov_id == RML_OFI_PROV_ID_INVALID ; prov_num++ ) {
1002-
cur_fi = orte_rml_ofi.ofi_prov[prov_num].fabric_info;
1003-
opal_output_verbose(20,orte_rml_base_framework.framework_output,
1004-
"%s -choosing fabric -> comparing %s != %s ",
1005-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ethernet,cur_fi->fabric_attr->prov_name);
1006-
if ( strcmp(ethernet, cur_fi->fabric_attr->prov_name) != 0) {
1007-
ofi_prov_id = prov_num;
1008-
opal_output_verbose(20,orte_rml_base_framework.framework_output,
1009-
"%s - Choosing fabric provider %s",
1010-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),cur_fi->fabric_attr->prov_name);
999+
cur_fi->fabric_attr->prov_name);
1000+
}
1001+
}
1002+
} else if ( choose_fabric ) {
1003+
// "fabric" is requested, choose the first fabric(non-ethernet) provider
1004+
for ( prov_num = 0; prov_num < orte_rml_ofi.ofi_prov_open_num && ofi_prov_id == RML_OFI_PROV_ID_INVALID ; prov_num++ ) {
1005+
cur_fi = orte_rml_ofi.ofi_prov[prov_num].fabric_info;
1006+
opal_output_verbose(20,orte_rml_base_framework.framework_output,
1007+
"%s -choosing fabric -> comparing %s != %s ",
1008+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ethernet,cur_fi->fabric_attr->prov_name);
1009+
if ( strcmp(ethernet, cur_fi->fabric_attr->prov_name) != 0) {
1010+
ofi_prov_id = prov_num;
1011+
opal_output_verbose(20,orte_rml_base_framework.framework_output,
1012+
"%s - Choosing fabric provider %s",
1013+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),cur_fi->fabric_attr->prov_name);
10111014
}
10121015
}
10131016
}
@@ -1165,7 +1168,7 @@ static void pr_cons(orte_rml_ofi_peer_t *ptr)
11651168
static void pr_des(orte_rml_ofi_peer_t *ptr)
11661169
{
11671170
if ( NULL != ptr->ofi_prov_name)
1168-
free(ptr->ofi_prov_name);
1171+
free(ptr->ofi_prov_name);
11691172
if ( 0 < ptr->ofi_ep_len)
11701173
free( ptr->ofi_ep);
11711174
}

orte/mca/rml/ofi/rml_ofi_send.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "orte_config.h"
1111

1212
#include "opal/dss/dss_types.h"
13+
#include "opal/util/net.h"
1314
#include "opal/util/output.h"
1415
#include "opal/mca/event/event.h"
1516

@@ -369,7 +370,7 @@ int orte_rml_ofi_recv_handler(struct fi_cq_data_entry *wc, uint8_t ofi_prov_id)
369370
/* populate_peer_ofi_addr
370371
* [Desc] This fn does a PMIx Modex recv on "rml.ofi" key
371372
* to get the ofi address blob of all providers on the peer.
372-
* Then it populates the array parameter peer_ofi_addr[]
373+
* Then it populates the array parameter peer_ofi_addr[]
373374
* with providername, ofi_ep_name and ofi_ep_namelen
374375
* [in] peer -> peer address
375376
* [out] peer_ofi_addr[] -> array to hold the provider details on the peer
@@ -451,18 +452,18 @@ static int populate_peer_ofi_addr(orte_process_name_t *peer, orte_rml_ofi_peer_t
451452
}
452453

453454

454-
/* check_provider_in_peer(prov_name, peer_ofi_addr)
455+
/* check_provider_in_peer(prov_name, peer_ofi_addr)
455456
* [Desc] This fn checks for a match of prov_name in the peer_ofi_addr array
456457
* and returns the index of the match or OPAL_ERROR if not found.
457458
* The peer_ofi_addr array has all the ofi providers in peer.
458459
* [in] prov_name -> The provider name we want to use to send this message to peer.
459460
* [in] tot_prov -> total provider entries in array
460461
* [in] peer_ofi_addr[] -> array of provider details on the peer
461-
* [in] local_ofi_prov_idx -> the index of local provider we are comparing with
462+
* [in] local_ofi_prov_idx -> the index of local provider we are comparing with
462463
* (index into orte_rml_ofi.ofi_prov[] array.
463464
* [Return value] -> index that matches provider on success. OPAL_ERROR if no match found.
464465
*/
465-
static int check_provider_in_peer( char *prov_name, int tot_prov, orte_rml_ofi_peer_t *peer_ofi_addr, int local_ofi_prov_idx )
466+
static int check_provider_in_peer( char *prov_name, int tot_prov, orte_rml_ofi_peer_t *peer_ofi_addr, int local_ofi_prov_idx )
466467
{
467468
int idx;
468469
int ret = OPAL_ERROR;
@@ -495,7 +496,7 @@ static int check_provider_in_peer( char *prov_name, int tot_prov, orte_rml_ofi_p
495496
} else {
496497
ret = idx;
497498
break;
498-
}
499+
}
499500
}
500501
}
501502
return ret;
@@ -519,7 +520,7 @@ static void send_msg(int fd, short args, void *cbdata)
519520
orte_rml_ofi_peer_t* pr;
520521
uint64_t ui64;
521522
struct sockaddr_in* ep_sockaddr;
522-
523+
523524
snd = OBJ_NEW(orte_rml_send_t);
524525
snd->dst = *peer;
525526
snd->origin = *ORTE_PROC_MY_NAME;
@@ -565,19 +566,19 @@ static void send_msg(int fd, short args, void *cbdata)
565566
return;
566567
}
567568
/* decide the provider we want to use from the list of providers in peer as per below order.
568-
* 1. if the user specified the transport for this conduit (even giving us a prioritized list of candidates),
569-
* then the one we selected is the _only_ one we will use. If the remote peer has a matching endpoint,
569+
* 1. if the user specified the transport for this conduit (even giving us a prioritized list of candidates),
570+
* then the one we selected is the _only_ one we will use. If the remote peer has a matching endpoint,
570571
* then we use it - otherwise, we error out
571-
* 2. if the user did not specify a transport, then we look for matches against _all_ of
572+
* 2. if the user did not specify a transport, then we look for matches against _all_ of
572573
* our available transports, starting with fabric and then going to Ethernet, taking the first one that matches.
573574
* 3. if we cannot find any match, then we error out
574575
*/
575576
if ( true == user_override() ) {
576-
/*case 1. User has specified the provider, find a match in peer for the current selected provider or error out*/
577+
/*case 1. User has specified the provider, find a match in peer for the current selected provider or error out*/
577578
opal_output_verbose(1, orte_rml_base_framework.framework_output,
578579
"%s rml:ofi::send_msg() Case1. looking for a match for current provider",
579580
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
580-
if( OPAL_ERROR == ( peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[ofi_prov_id].fabric_info->fabric_attr->prov_name,
581+
if( OPAL_ERROR == ( peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[ofi_prov_id].fabric_info->fabric_attr->prov_name,
581582
tot_peer_prov, peer_ofi_addr, ofi_prov_id ) )) {
582583
opal_output_verbose(1, orte_rml_base_framework.framework_output,
583584
"%s rml:ofi::send_msg() Peer is Unreachable - no common ofi provider ",
@@ -595,8 +596,8 @@ static void send_msg(int fd, short args, void *cbdata)
595596
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
596597
for(int cur_prov_id=0; cur_prov_id < orte_rml_ofi.ofi_prov_open_num && !peer_match_found ; cur_prov_id++) {
597598
if( 0 != strcmp( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, "sockets" ) ) {
598-
peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name,
599-
tot_peer_prov, peer_ofi_addr, cur_prov_id );
599+
peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name,
600+
tot_peer_prov, peer_ofi_addr, cur_prov_id );
600601
if (OPAL_ERROR != peer_prov_id) {
601602
peer_match_found = true;
602603
ofi_prov_id = cur_prov_id;
@@ -609,7 +610,7 @@ static void send_msg(int fd, short args, void *cbdata)
609610
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
610611
for(int cur_prov_id=0; cur_prov_id < orte_rml_ofi.ofi_prov_open_num && !peer_match_found ; cur_prov_id++) {
611612
if( 0 == strcmp( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, "sockets" ) ) {
612-
peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name,
613+
peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name,
613614
tot_peer_prov, peer_ofi_addr, cur_prov_id );
614615
if (OPAL_ERROR != peer_prov_id) {
615616
peer_match_found = true;
@@ -628,15 +629,15 @@ static void send_msg(int fd, short args, void *cbdata)
628629
return ;
629630
}
630631
}
631-
/* creating a copy of the chosen provider to put it in hashtable
632-
* as the ofi_peer_addr array is local */
632+
/* creating a copy of the chosen provider to put it in hashtable
633+
* as the ofi_peer_addr array is local */
633634
pr = OBJ_NEW(orte_rml_ofi_peer_t);
634635
pr->ofi_ep_len = peer_ofi_addr[peer_prov_id].ofi_ep_len;
635636
pr->ofi_ep = malloc(pr->ofi_ep_len);
636637
memcpy(pr->ofi_ep,peer_ofi_addr[peer_prov_id].ofi_ep,pr->ofi_ep_len);
637638
pr->ofi_prov_name = strdup(peer_ofi_addr[peer_prov_id].ofi_prov_name);
638639
pr->src_prov_id = ofi_prov_id;
639-
if(OPAL_SUCCESS !=
640+
if(OPAL_SUCCESS !=
640641
(rc = opal_hash_table_set_value_uint64(&orte_rml_ofi.peers, ui64, (void*)pr))) {
641642
opal_output_verbose(15, orte_rml_base_framework.framework_output,
642643
"%s: ofi address insertion into hash table failed for peer %s ",
@@ -653,7 +654,7 @@ static void send_msg(int fd, short args, void *cbdata)
653654
opal_output_verbose(1, orte_rml_base_framework.framework_output,
654655
"%s rml:ofi: OFI peer contact info got from hash table",
655656
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
656-
dest_ep_name = pr->ofi_ep;
657+
dest_ep_name = pr->ofi_ep;
657658
dest_ep_namelen = pr->ofi_ep_len;
658659
ofi_prov_id = pr->src_prov_id;
659660
}

0 commit comments

Comments
 (0)