From 5e2bc2c662c22f5cda4ddfe8214990770d202382 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Fri, 29 May 2015 08:44:03 -0600 Subject: [PATCH] btl/openib: fix coverity issue CID 1269821 Dereference null return value (NULL_RETURNS) This is another false positive that can be silenced by looping on opal_list_remove_first instead of using both opal_list_is_empty and opal_list_remove_first. Signed-off-by: Nathan Hjelm --- opal/mca/btl/openib/btl_openib_endpoint.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/openib/btl_openib_endpoint.c b/opal/mca/btl/openib/btl_openib_endpoint.c index 540c3902c0..a4f84e0892 100644 --- a/opal/mca/btl/openib/btl_openib_endpoint.c +++ b/opal/mca/btl/openib/btl_openib_endpoint.c @@ -613,13 +613,13 @@ void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint) opal_progress_event_users_decrement(); if(MCA_BTL_XRC_ENABLED) { - while(master && !opal_list_is_empty(&endpoint->ib_addr->pending_ep)) { - ep_item = opal_list_remove_first(&endpoint->ib_addr->pending_ep); - ep = (mca_btl_openib_endpoint_t *)ep_item; - if (OPAL_SUCCESS != - opal_btl_openib_connect_base_start(endpoint->endpoint_local_cpc, - ep)) { - BTL_ERROR(("Failed to connect pending endpoint\n")); + if (master) { + while (NULL != (ep_item = opal_list_remove_first(&endpoint->ib_addr->pending_ep))) { + ep = (mca_btl_openib_endpoint_t *)ep_item; + if (OPAL_SUCCESS != + opal_btl_openib_connect_base_start(endpoint->endpoint_local_cpc, ep)) { + BTL_ERROR(("Failed to connect pending endpoint\n")); + } } } OPAL_THREAD_UNLOCK(&endpoint->ib_addr->addr_lock);