Skip to content

Commit ff12256

Browse files
authored
Merge pull request #9401 from rhc54/topic/hwold
Fix segfault in some cases where old hwloc is used
2 parents 262e51b + 4086aa4 commit ff12256

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
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)