Skip to content

Commit eb2c108

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 7884ac2 commit eb2c108

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
@@ -633,9 +633,9 @@ static bool is_near(pmix_device_distance_t *distances,
633633
ret = sscanf(distances[i].uuid, "fab://%256s::%256s", lnguid, lsguid);
634634
if (ret != 2)
635635
continue;
636-
if (0 == strcasecmp(lnguid, nguid)) {
636+
if (nguid && (0 == strcasecmp(lnguid, nguid))) {
637637
return true;
638-
} else if (0 == strcasecmp(lsguid, sguid)) {
638+
} else if (sguid && (0 == strcasecmp(lsguid, sguid))) {
639639
return true;
640640
}
641641
}
@@ -772,8 +772,8 @@ struct fi_info *opal_common_ofi_select_provider(struct fi_info *provider_list,
772772
pmix_value_t *pmix_val;
773773
struct fi_pci_attr pci;
774774
int num_distances = 0;
775-
bool near;
776775
#endif
776+
bool near = false;
777777
int ret;
778778
unsigned int num_provider = 0, provider_limit = 0;
779779
bool provider_found = false;

0 commit comments

Comments
 (0)