[dpdk-dev,1/3,v3] bnxt: use appropriate data type in bnxt_alloc_vnic_attributes

Message ID 20161107151204.GA24819@C02PT1RBG8WP.wifi.aus.avagotech.net (mailing list archive)
State Accepted, archived
Headers

Commit Message

Ajit Khaparde Nov. 7, 2016, 3:12 p.m. UTC
  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(-)
  

Comments

Thomas Monjalon Nov. 7, 2016, 6:35 p.m. UTC | #1
2016-11-07 09:12, Ajit Khaparde:
> 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>

Series applied, thanks

As a regular contributor, please follow the contribution guidelines:
	http://dpdk.org/dev#send
  

Patch

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;