Skip to content

Commit 47f18dc

Browse files
ofi: Fix Coverity warnings
Fix two coverity warnings: - Uninitialized variables (UNINIT) in /opal/mca/common/ofi/common_ofi.c: 859 in opal_common_ofi_select_provider() - Null pointer dereferences (FORWARD_NULL) /opal/mca/common/ofi/common_ofi.c: 636 in is_near() Move the "near" parameter in opal_common_ofi_select_provider() outside the #if OPAL_OFI_PCI_DATA_AVAILABLE block, because later in the code it's being used outside of it. Signed-off-by: Amir Shehata <shehataa@ornl.gov>
1 parent 37f1f82 commit 47f18dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

opal/mca/common/ofi/common_ofi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ static bool is_near(pmix_device_distance_t *distances,
651651
ret = sscanf(distances[i].uuid, "fab://%256s::%256s", lnguid, lsguid);
652652
if (ret != 2)
653653
continue;
654-
if (0 == strcasecmp(lnguid, nguid)) {
654+
if (nguid && (0 == strcasecmp(lnguid, nguid))) {
655655
return true;
656-
} else if (0 == strcasecmp(lsguid, sguid)) {
656+
} else if (sguid && (0 == strcasecmp(lsguid, sguid))) {
657657
return true;
658658
}
659659
}
@@ -789,7 +789,7 @@ struct fi_info *opal_common_ofi_select_provider(struct fi_info *provider_list,
789789
struct fi_pci_attr pci;
790790
int num_distances = 0;
791791
#endif
792-
bool near;
792+
bool near = false;
793793
int ret;
794794
unsigned int num_provider = 0, provider_limit = 0;
795795
bool provider_found = false;

0 commit comments

Comments
 (0)