raw/octeontx2_ep: fix coverity scan reported defects
PATCH 1/1 raw/octeontx2_ep: fix coverity scan reported defects
Defects reported by coverity scan are resolved. Coverity issue: CID 353611 - Error handling. Coverity issue: CID 353622 - Error handling. Coverity issue: CID 353632 - NULL pointer dereference.
Signed-off-by Mahipal Challa <[email protected]>
--- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +10 -8
@@ -257,8 +257,8 @@void *buf;for (idx =0 ; idx < droq->nb_desc; idx++) { -rte_mempool_get (sdpvf->enqdeq_mpool, &buf); -if (buf ==NULL ) { +if (rte_mempool_get (sdpvf->enqdeq_mpool, &buf) || + (buf ==NULL )) {otx2_err ("OQ buffer alloc failed" ); droq->stats.rx_alloc_failure++;/* sdp_droq_destroy_ring_buffers(droq);*/
@@ -662,11 +662,11 @@if (droq->recv_buf_list[droq->refill_idx].buffer !=NULL )break ; -rte_mempool_get (sdpvf->enqdeq_mpool, &buf); -/* If a buffer could not be allocated, no point in -* continuing -*/ -if (buf ==NULL ) { +if (rte_mempool_get (sdpvf->enqdeq_mpool, &buf) || + (buf ==NULL )) { +/* If a buffer could not be allocated, no point in +* continuing +*/ droq->stats.rx_alloc_failure++;break ; }
@@ -780,7 +780,7 @@ droq = sdpvf->droq[q_no];if (!droq) {otx2_err ("Invalid droq[%d]" , q_no); - goto deq_fail; + goto droq_err; }/* Grab the lock */
@@ -840,5 +840,7 @@ deq_fail:rte_spinlock_unlock (&droq->lock); + +droq_err:return SDP_OQ_RECV_FAILED ; }
Signature · 1 line
1.8.3.1
Thomas Monjalon
Applied27/01/2020 14:18, Mahipal Challa:
Quoted 6 lines
Defects reported by coverity scan are resolved. Coverity issue: CID 353611 - Error handling. Coverity issue: CID 353622 - Error handling. Coverity issue: CID 353632 - NULL pointer dereference.
Signed-off-by Mahipal Challa <[email protected]>
Applied, thanks