From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E0D3A0531; Mon, 27 Jan 2020 14:18:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD8AE1BFDC; Mon, 27 Jan 2020 14:18:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 065D51BFD6 for ; Mon, 27 Jan 2020 14:18:40 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00RDD8CI019388; Mon, 27 Jan 2020 05:18:37 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=x4vV6oRfw8fCbYjdkmT7COrWJ4vsqWwGp+icA8uKfeE=; b=TnVMcDO3xQevrXqNxW5JPS3GcLgplIy6r/CpzPYsyYrCzXdK5VaXGVrnK5QhulePNq85 4gtFv+bbEomFb3DvsN7+r7/PGA6Q4PgxtZt9kSjxiP++LFB9LmNSZDglHtW98O/ZxO8D J5GEzCOIo3OegO1sScfkzYpRN7xEXZHYTdxNnybU7lZxBrNtb2yFbw682VsNmcnEwhbR xLTqExdJYmUyK73UheX3mKtoNgpd0UQCcKfL0OnO9BBtmoPqqkOqun+igJ9QgpVsS+Hn uPZqYgptI8bfrvrj9MlNqLxBZ4YeZVxLSYtqtoL0SMLDgK0xVnWfwEqJSGH09ZLZBrWT Og== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2xrkwufcwa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 27 Jan 2020 05:18:37 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jan 2020 05:18:35 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jan 2020 05:18:35 -0800 Received: from hyd1244.marvell.com (hyd1244.marvell.com [10.29.20.28]) by maili.marvell.com (Postfix) with ESMTP id 700463F703F; Mon, 27 Jan 2020 05:18:33 -0800 (PST) From: Mahipal Challa To: , CC: , , , , Date: Mon, 27 Jan 2020 18:48:21 +0530 Message-ID: <1580131101-16945-1-git-send-email-mchalla@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-27_02:2020-01-24, 2020-01-27 signatures=0 Subject: [dpdk-dev] [dpdk-dev PATCH] raw/octeontx2_ep: fix coverity scan reported defects X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 1ba27c9..9f1e5ed 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -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; } -- 1.8.3.1