Skip to content

Commit bd7f002

Browse files
committed
Fix wrongly placed bounds check; mark failure as unlikely
Signed-off-by: Christoph Niethammer <niethammer@hlrs.de>
1 parent e1e8b2a commit bd7f002

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

opal/runtime/opal_cr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ int opal_cr_user_inc_register_callback(opal_cr_user_inc_callback_event_t event,
870870
opal_cr_user_inc_callback_fn_t function,
871871
opal_cr_user_inc_callback_fn_t *prev_function)
872872
{
873-
if (event >= OPAL_CR_INC_MAX) {
873+
if (OPAL_UNLIKELY(event >= OPAL_CR_INC_MAX)) {
874874
return OPAL_ERROR;
875875
}
876876

@@ -888,12 +888,12 @@ int opal_cr_user_inc_register_callback(opal_cr_user_inc_callback_event_t event,
888888
int ompi_trigger_user_inc_callback(opal_cr_user_inc_callback_event_t event,
889889
opal_cr_user_inc_callback_state_t state)
890890
{
891-
if( NULL == cur_user_coord_callback[event] ) {
892-
return OPAL_SUCCESS;
891+
if (OPAL_UNLIKELY(event >= OPAL_CR_INC_MAX)) {
892+
return OPAL_ERROR;
893893
}
894894

895-
if (event >= OPAL_CR_INC_MAX) {
896-
return OPAL_ERROR;
895+
if( NULL == cur_user_coord_callback[event] ) {
896+
return OPAL_SUCCESS;
897897
}
898898

899899
return ((cur_user_coord_callback[event])(event, state));

0 commit comments

Comments
 (0)