From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ajit.khaparde@broadcom.com>
Received: from relay.smtp.broadcom.com (unknown [192.19.211.62])
 by dpdk.org (Postfix) with ESMTP id AA2B8558A
 for <dev@dpdk.org>; Mon,  7 Nov 2016 16:12:07 +0100 (CET)
Received: from mail-irv-17.broadcom.com (mail-irv-17.broadcom.com
 [10.15.198.34])
 by relay.smtp.broadcom.com (Postfix) with ESMTP id 808932802B7;
 Mon,  7 Nov 2016 07:12:06 -0800 (PST)
Received: from C02PT1RBG8WP.wifi.aus.avagotech.net
 (c02pt1rbg8wp.wifi.aus.avagotech.net [10.10.168.137])
 by mail-irv-17.broadcom.com (Postfix) with ESMTP id 8740781F52;
 Mon,  7 Nov 2016 07:12:05 -0800 (PST)
Date: Mon, 7 Nov 2016 09:12:04 -0600
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Message-ID: <20161107151204.GA24819@C02PT1RBG8WP.wifi.aus.avagotech.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <a5c6b4f5-f50e-fccc-d33d-ec50f182e36c@intel.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Subject: [dpdk-dev] [PATCH 1/3 v3] bnxt: use appropriate data type in
 bnxt_alloc_vnic_attributes
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Nov 2016 15:12:08 -0000

Prevent the arithmetic in bnxt_alloc_vnic_attributes from causing
any unintentional havoc because of the usage of a signed variable.

Coverity: 137874

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

--
v1: attempt did not seem complete.
v2: simplify the fix by redoing the fix for Coverity 127557
---
 drivers/net/bnxt/bnxt_vnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 205a940..33fdde2 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -175,7 +175,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	const struct rte_memzone *mz;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
-	uint16_t entry_length = RTE_CACHE_LINE_ROUNDUP(
+	uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP(
 				HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
 				HW_HASH_KEY_SIZE);
 	uint16_t max_vnics;
-- 
1.8.3.1