diff --git a/prov/efa/src/efa_mr.c b/prov/efa/src/efa_mr.c index c803ff42cf3..161707a7dab 100644 --- a/prov/efa/src/efa_mr.c +++ b/prov/efa/src/efa_mr.c @@ -338,7 +338,7 @@ static int efa_mr_cache_regattr(struct fid *fid, const struct fi_mr_attr *attr, domain = container_of(fid, struct efa_domain, util_domain.domain_fid.fid); - assert(attr->iov_count == 1); + assert(attr->iov_count > 0 && attr->iov_count <= domain->info->domain_attr->mr_iov_limit); ofi_mr_info_get_iov_from_mr_attr(&info, attr, flags); info.iface = attr->iface; info.device = attr->device.reserved; diff --git a/prov/efa/src/rdm/efa_rdm_ep_utils.c b/prov/efa/src/rdm/efa_rdm_ep_utils.c index 1755f7fa8af..2968a096318 100644 --- a/prov/efa/src/rdm/efa_rdm_ep_utils.c +++ b/prov/efa/src/rdm/efa_rdm_ep_utils.c @@ -211,6 +211,9 @@ int efa_rdm_ep_post_user_recv_buf(struct efa_rdm_ep *ep, struct efa_rdm_ope *rxe struct efa_mr *mr; int err; + /* + * TODO remove/change assert expression when function logic is fixed + */ assert(rxe->iov_count == 1); assert(rxe->iov[0].iov_len >= ep->msg_prefix_size); pkt_entry = (struct efa_rdm_pke *)rxe->iov[0].iov_base; diff --git a/prov/efa/src/rdm/efa_rdm_ope.c b/prov/efa/src/rdm/efa_rdm_ope.c index e331c72f67c..c326a9b806c 100644 --- a/prov/efa/src/rdm/efa_rdm_ope.c +++ b/prov/efa/src/rdm/efa_rdm_ope.c @@ -1204,7 +1204,7 @@ ssize_t efa_rdm_txe_prepare_local_read_pkt_entry(struct efa_rdm_ope *txe) struct efa_rdm_pke *pkt_entry_copy; assert(txe->type == EFA_RDM_TXE); - assert(txe->rma_iov_count == 1); + assert(txe->rma_iov_count > 0 && txe->rma_iov_count <= efa_rdm_ep_domain(txe->ep)->info->tx_attr->rma_iov_limit); pkt_entry = txe->local_read_pkt_entry; if (pkt_entry->mr && !(txe->ep->sendrecv_in_order_aligned_128_bytes)) @@ -1286,11 +1286,11 @@ int efa_rdm_ope_post_read(struct efa_rdm_ope *ope) struct efa_rdm_ep *ep; struct efa_rdm_pke *pkt_entry; - assert(ope->iov_count > 0); - assert(ope->rma_iov_count > 0); - ep = ope->ep; + assert(ope->iov_count > 0 && ope->iov_count <= efa_rdm_ep_domain(ep)->info->tx_attr->iov_limit); + assert(ope->rma_iov_count > 0 && ope->rma_iov_count <= efa_rdm_ep_domain(ep)->info->tx_attr->rma_iov_limit); + if (ope->bytes_read_total_len == 0) { /* According to libfabric document @@ -1431,9 +1431,11 @@ int efa_rdm_ope_post_remote_write(struct efa_rdm_ope *ope) struct efa_rdm_ep *ep; struct efa_rdm_pke *pkt_entry; - assert(ope->iov_count > 0); - assert(ope->rma_iov_count > 0); ep = ope->ep; + + assert(ope->iov_count > 0 && ope->iov_count <= efa_rdm_ep_domain(ep)->info->tx_attr->iov_limit); + assert(ope->rma_iov_count > 0 && ope->rma_iov_count <= efa_rdm_ep_domain(ep)->info->tx_attr->rma_iov_limit); + if (ope->bytes_write_total_len == 0) { /* According to libfabric document * https://ofiwg.github.io/libfabric/main/man/fi_rma.3.html