Skip to content

Commit 09478c4

Browse files
rhc54awlauria
authored andcommitted
Protect against segfault in some cases where old hwloc is used
Signed-off-by: Ralph Castain <rhc@pmix.org> (cherry picked from commit 4086aa4)
1 parent a81d3cd commit 09478c4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

opal/mca/hwloc/base/hwloc_base_util.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,16 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
152152
if (NULL == opal_hwloc_base_cpu_list) {
153153
/* get the root available cpuset */
154154
#if HWLOC_API_VERSION < 0x20000
155-
avail = hwloc_bitmap_alloc();
156-
hwloc_bitmap_and(avail, root->online_cpuset, root->allowed_cpuset);
155+
if (NULL == root->online_cpuset || NULL == root->allowed_cpuset) {
156+
if (NULL == root->cpuset) {
157+
/* we have a really bad topology */
158+
return OPAL_ERR_NOT_SUPPORTED;
159+
}
160+
avail = hwloc_bitmap_dup(root->cpuset);
161+
} else {
162+
avail = hwloc_bitmap_alloc();
163+
hwloc_bitmap_and(avail, root->online_cpuset, root->allowed_cpuset);
164+
}
157165
#else
158166
avail = hwloc_bitmap_dup(root->cpuset);
159167
#endif

0 commit comments

Comments
 (0)