Skip to content

Commit

Permalink
Protect against NULL returned obj
Browse files Browse the repository at this point in the history
Running into issues with LSF and the way they are indexing
objects in their affinity files. Try to avoid a segfault
in favor of just erroring out.

Signed-off-by: Ralph Castain <[email protected]>
  • Loading branch information
rhc54 committed Oct 26, 2024
1 parent d5e580a commit b3019ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mca/rmaps/rank_file/rmaps_rank_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,12 @@ static int prte_rmaps_rf_lsf_convert_affinity_to_rankfile(char *affinity_file, c
for(i = 0; NULL != cpus[i]; ++i) {
// assume HNP has the same topology as other nodes
obj = hwloc_get_pu_obj_by_os_index(my_topo->topo, strtol(cpus[i], NULL, 10)) ;

if (NULL == obj) {
PMIX_ARGV_FREE_COMPAT(cpus);
fclose(fp);
close(fp_rank);
return PRTE_ERROR;
}
free(cpus[i]);
// 10 max number of digits in an int
cpus[i] = (char*)malloc(sizeof(char) * 10);
Expand Down

0 comments on commit b3019ce

Please sign in to comment.