From patchwork Mon Apr 12 19:03:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 91122 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B145AA0524; Mon, 12 Apr 2021 21:03:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DD8A1412C1; Mon, 12 Apr 2021 21:03:59 +0200 (CEST) Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by mails.dpdk.org (Postfix) with ESMTP id 2F4231412BE; Mon, 12 Apr 2021 21:03:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1550; q=dns/txt; s=iport; t=1618254237; x=1619463837; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dTcMSZRRSJwn5cxG8IGLXkjWYNsoY98/15ZrCMpNPRs=; b=P7ABdOD1WzYQcX4o7iL+nWK5o734La+D7GUa1cbALWeJ0kYYVroRNfCY sWN4q5LqowuJgPtsCryThophQrqPrHYNVLP4brpqvpOI2pXRBm6CGyNC9 i6UUmg1KqnoTQ8bzQxpDQvLEV4I0MfOx0v7mzFWmoRvFlexm/4lIyD6Sz w=; X-IronPort-AV: E=Sophos;i="5.82,216,1613433600"; d="scan'208";a="668663876" Received: from alln-core-10.cisco.com ([173.36.13.132]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 12 Apr 2021 19:03:56 +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 13CJ3tHW020873; Mon, 12 Apr 2021 19:03:55 GMT Received: by cisco.com (Postfix, from userid 392789) id A4B9720F2005; Mon, 12 Apr 2021 12:03:55 -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 12:03:38 -0700 Message-Id: <20210412190338.5248-1-johndale@cisco.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 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] 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 extention 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 --- 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(