DPDK patches and discussions
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/4] bnxt_alloc_vnic_attributes: ensure entry_length is unsigned
Date: Wed, 28 Sep 2016 15:20:02 -0400	[thread overview]
Message-ID: <1475090404-20707-3-git-send-email-linville@tuxdriver.com> (raw)
In-Reply-To: <1475090404-20707-1-git-send-email-linville@tuxdriver.com>

Otherwise, the inherent cast when multiplying entry_length by max_vnics
in the call to rte_memzone_reserve could promote max_vnics to a signed
value, causing hilarity to ensue...

Coverity: 127557

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 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 c04c4c740645..1b5f54c4d1ae 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];
-	int entry_length = RTE_CACHE_LINE_ROUNDUP(
+	uint16_t entry_length = RTE_CACHE_LINE_ROUNDUP(
 				HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
 				HW_HASH_KEY_SIZE);
 	uint16_t max_vnics;
-- 
2.7.4

  parent reply	other threads:[~2016-09-28 19:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 19:20 [dpdk-dev] [PATCH 0/4] random fixes for bugs identified by Coverity John W. Linville
2016-09-28 19:20 ` [dpdk-dev] [PATCH 1/4] ena_config_host_info: improve safety of string handling John W. Linville
2016-09-28 19:20 ` John W. Linville [this message]
2016-09-28 19:20 ` [dpdk-dev] [PATCH 3/4] i40e_vsi_release: do not use vsi until after NULL check John W. Linville
2016-09-29  8:15   ` Ferruh Yigit
2016-09-28 19:20 ` [dpdk-dev] [PATCH 4/4] bnxt_mac_addr_remove_op: add ULL suffix to constant 1 in bit shift John W. Linville
2016-09-29 17:39 ` [dpdk-dev] [PATCH v2 0/4] random fixes for bugs identified by Coverity John W. Linville
2016-09-29 17:39   ` [dpdk-dev] [PATCH v2 1/4] net/ena: improve safety of string handling in ena_config_host_info John W. Linville
2016-10-12 16:24     ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2016-09-29 17:39   ` [dpdk-dev] [PATCH v2 2/4] net/bnxt: ensure entry_length is unsigned in bnxt_alloc_vnic_attributes John W. Linville
2016-09-29 19:06     ` Ajit Khaparde
2016-09-29 17:39   ` [dpdk-dev] [PATCH v2 3/4] net/i40e: do not use vsi until after NULL check in i40e_vsi_release John W. Linville
2016-09-29 17:39   ` [dpdk-dev] [PATCH v2 4/4] net/bnxt: add ULL suffix to constant 1 for bit shift in bnxt_mac_addr_remove_op John W. Linville
2016-10-10 18:41     ` Ajit Khaparde
2016-10-13  9:31   ` [dpdk-dev] [PATCH v2 0/4] random fixes for bugs identified by Coverity Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475090404-20707-3-git-send-email-linville@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).