Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 0d5cd63

Browse files
committed
btl/openib: fix segmentation fault
This commit fixes a segmentation fault that occurs if a device can be initialized but not used. In this case the devices_count is not equal to the number of usable devices in the devices pointer array. Thanks to @artpol84 for tracking this down. Fixes open-mpi/ompi#1823 Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from open-mpi/ompi@8128c8e) Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 9b00cae commit 0d5cd63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

opal/mca/btl/openib/btl_openib_component.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,9 @@ static int btl_openib_component_progress(void)
37433743
for(i = 0; i < mca_btl_openib_component.devices_count; i++) {
37443744
mca_btl_openib_device_t *device =
37453745
(mca_btl_openib_device_t *) opal_pointer_array_get_item(&mca_btl_openib_component.devices, i);
3746-
count += progress_one_device(device);
3746+
if (NULL != device) {
3747+
count += progress_one_device(device);
3748+
}
37473749
}
37483750

37493751
#if OPAL_CUDA_SUPPORT /* CUDA_ASYNC_SEND */

0 commit comments

Comments
 (0)