Skip to content

Commit 8128c8e

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 #1823 Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 679a66c commit 8128c8e

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
@@ -3771,7 +3771,9 @@ static int btl_openib_component_progress(void)
37713771
for(i = 0; i < mca_btl_openib_component.devices_count; i++) {
37723772
mca_btl_openib_device_t *device =
37733773
(mca_btl_openib_device_t *) opal_pointer_array_get_item(&mca_btl_openib_component.devices, i);
3774-
count += progress_one_device(device);
3774+
if (NULL != device) {
3775+
count += progress_one_device(device);
3776+
}
37753777
}
37763778

37773779
#if OPAL_CUDA_SUPPORT /* CUDA_ASYNC_SEND */

0 commit comments

Comments
 (0)