Skip to content

Commit 35a967a

Browse files
authored
Merge pull request #10088 from bosilca/topic/deal_with_null_descriptor_in_sendi
Accept a NULL pointer to descriptor in sendi.
2 parents 8c1495d + 1ee52d0 commit 35a967a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

opal/mca/btl/self/btl_self.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2022 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -248,7 +248,9 @@ static int mca_btl_self_sendi(struct mca_btl_base_module_t *btl,
248248
frag = mca_btl_self_prepare_src(btl, endpoint, convertor, order, header_size, &payload_size,
249249
flags | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP);
250250
if (NULL == frag) {
251-
*descriptor = NULL;
251+
if( NULL != descriptor ) {
252+
*descriptor = NULL;
253+
}
252254
return OPAL_ERR_OUT_OF_RESOURCE;
253255
}
254256

opal/mca/btl/smcuda/btl_smcuda.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2014 The University of Tennessee and The University
6+
* Copyright (c) 2004-2022 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
@@ -876,11 +876,7 @@ int mca_btl_smcuda_sendi(struct mca_btl_base_module_t *btl,
876876
}
877877
/* We do not want to use this path when we have CUDA IPC support */
878878
if ((convertor->flags & CONVERTOR_CUDA) && (IPC_ACKED == endpoint->ipcstate)) {
879-
if (NULL != descriptor) {
880-
*descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size,
881-
flags);
882-
}
883-
return OPAL_ERR_RESOURCE_BUSY;
879+
goto return_resource_busy;
884880
}
885881
#endif /* OPAL_CUDA_SUPPORT */
886882

@@ -942,8 +938,10 @@ int mca_btl_smcuda_sendi(struct mca_btl_base_module_t *btl,
942938
return OPAL_SUCCESS;
943939
}
944940

945-
/* presumably, this code path will never get executed */
946-
*descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size, flags);
941+
return_resource_busy:
942+
if (NULL != descriptor) {
943+
*descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size, flags);
944+
}
947945
return OPAL_ERR_RESOURCE_BUSY;
948946
}
949947

0 commit comments

Comments
 (0)