X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fdpdk%2Fcryptodev%2Fcryptodev.c;h=fa54d2bf4fc8435ed1e342402bce3a093330fb8a;hb=f0c67adfb27f6a6a37ccea7e359a416ecdf01825;hp=8750ffd3c31866cb758947055ceeb99c4a683387;hpb=30ecfa8ceb884771ba4e3f1da6da8fc07efa6c17;p=vpp.git diff --git a/src/plugins/dpdk/cryptodev/cryptodev.c b/src/plugins/dpdk/cryptodev/cryptodev.c index 8750ffd3c31..fa54d2bf4fc 100644 --- a/src/plugins/dpdk/cryptodev/cryptodev.c +++ b/src/plugins/dpdk/cryptodev/cryptodev.c @@ -579,14 +579,14 @@ cryptodev_assign_resource (cryptodev_engine_thread_t * cet, return -EBUSY; vec_foreach_index (idx, cmt->cryptodev_inst) - { - cinst = cmt->cryptodev_inst + idx; - if (cinst->dev_id == cet->cryptodev_id && - cinst->q_id == cet->cryptodev_q) - break; - } + { + cinst = cmt->cryptodev_inst + idx; + if (cinst->dev_id == cet->cryptodev_id && + cinst->q_id == cet->cryptodev_q) + break; + } /* invalid existing worker resource assignment */ - if (idx == vec_len (cmt->cryptodev_inst)) + if (idx >= vec_len (cmt->cryptodev_inst)) return -EINVAL; clib_spinlock_lock (&cmt->tlock); clib_bitmap_set_no_check (cmt->active_cdev_inst_mask, idx, 0); @@ -1269,7 +1269,7 @@ dpdk_cryptodev_init (vlib_main_t * vm) vec_free (unique_drivers); #endif - clib_bitmap_vec_validate (cmt->active_cdev_inst_mask, tm->n_vlib_mains); + clib_bitmap_vec_validate (cmt->active_cdev_inst_mask, n_workers); clib_spinlock_init (&cmt->tlock); vec_validate_aligned(cmt->per_thread_data, tm->n_vlib_mains - 1,