1
1

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 <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2016-06-28 10:26:16 -06:00
родитель 679a66ccc8
Коммит 8128c8eb29

Просмотреть файл

@ -3771,8 +3771,10 @@ static int btl_openib_component_progress(void)
for(i = 0; i < mca_btl_openib_component.devices_count; i++) { for(i = 0; i < mca_btl_openib_component.devices_count; i++) {
mca_btl_openib_device_t *device = mca_btl_openib_device_t *device =
(mca_btl_openib_device_t *) opal_pointer_array_get_item(&mca_btl_openib_component.devices, i); (mca_btl_openib_device_t *) opal_pointer_array_get_item(&mca_btl_openib_component.devices, i);
if (NULL != device) {
count += progress_one_device(device); count += progress_one_device(device);
} }
}
#if OPAL_CUDA_SUPPORT /* CUDA_ASYNC_SEND */ #if OPAL_CUDA_SUPPORT /* CUDA_ASYNC_SEND */
/* Check to see if there are any outstanding dtoh CUDA events that /* Check to see if there are any outstanding dtoh CUDA events that