From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FF49A0524; Mon, 12 Apr 2021 22:50:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 084E41412DC; Mon, 12 Apr 2021 22:50:33 +0200 (CEST) Received: from alln-iport-6.cisco.com (alln-iport-6.cisco.com [173.37.142.93]) by mails.dpdk.org (Postfix) with ESMTP id 326F11412D4; Mon, 12 Apr 2021 22:50:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1566; q=dns/txt; s=iport; t=1618260631; x=1619470231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QlIYKR/DbsLvTqHmfJmTxCxnuLoKGM0xWeXBkfD7mDI=; b=SO8K9I+VvXUMXTlpIElJA9RNIgB64+e64vgyKl5PoDeLuthcakcwFQRA U8vjAYVeJWFB/Ja+J9841G109SyQul/xT4PpdChSVqdhhVvMCDRCM5SSm 0b6vkIo7xQLiRHlPutIoqE2J37X4Fw24mK5sPGYv0iBalgmRGe2V/hNP9 w=; X-IronPort-AV: E=Sophos;i="5.82,216,1613433600"; d="scan'208";a="719368385" Received: from alln-core-10.cisco.com ([173.36.13.132]) by alln-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 12 Apr 2021 20:50:30 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-10.cisco.com (8.15.2/8.15.2) with ESMTP id 13CKoTcr002830; Mon, 12 Apr 2021 20:50:30 GMT Received: by cisco.com (Postfix, from userid 392789) id CAF0F20F2005; Mon, 12 Apr 2021 13:50:29 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, John Daley , stable@dpdk.org, Hyong Youb Kim Date: Mon, 12 Apr 2021 13:50:21 -0700 Message-Id: <20210412205021.22378-1-johndale@cisco.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210412190338.5248-1-johndale@cisco.com> References: <20210412190338.5248-1-johndale@cisco.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: alln-core-10.cisco.com Subject: [dpdk-dev] [PATCH v1] net/enic: fix completion pointer calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The completion queue index could be implicitly extended past its uint16_t size when multiplied by the size of the descriptor. While this should not be a problem, coverity flags it. Do the extension explicitly by casting the index to uintptr_t. Coverity issue: 161317 Fixes: 8b428cb5a92e ("net/enic: use 64B completion queue entries if available") Cc: stable@dpdk.org Signed-off-by: John Daley Reviewed-by: Hyong Youb Kim --- v1: fix typo drivers/net/enic/enic_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index a2a02227e3..3899907d6d 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -70,7 +70,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts, cq = &enic->cq[enic_cq_rq(enic, sop_rq->index)]; cq_idx = cq->to_clean; /* index of cqd, rqd, mbuf_table */ cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) + - cq_idx * desc_size); + (uintptr_t)cq_idx * desc_size); color = cq->last_color; data_rq = &enic->rq[sop_rq->data_queue_idx]; @@ -126,7 +126,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts, /* Prefetch next mbuf & desc while processing current one */ cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) + - cq_idx * desc_size); + (uintptr_t)cq_idx * desc_size); rte_enic_prefetch(cqd_ptr); ciflags = enic_cq_rx_desc_ciflags( -- 2.26.2