DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] bond: changed rx and tx queue_id field type to prevent data loss.
Date: Fri, 20 Feb 2015 16:11:20 +0000	[thread overview]
Message-ID: <1424448680-5376-1-git-send-email-maciejx.t.gajdzica@intel.com> (raw)

Previous type of rx and tx queue_id field was int, which caused possible
data loss when calling functions expecting uint16_t as an argument.
Issue found with static code analysis tool.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c     |    3 ++-
 lib/librte_pmd_bond/rte_eth_bond_private.h |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index 7a17f53..a8df699 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -937,7 +937,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
 	struct bond_rx_queue *bd_rx_q;
 	struct bond_tx_queue *bd_tx_q;
 
-	int errval, q_id;
+	int errval;
+	uint16_t q_id;
 
 	/* Stop slave */
 	rte_eth_dev_stop(slave_eth_dev->data->port_id);
diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h
index 3da5a9e..65697bd 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_private.h
+++ b/lib/librte_pmd_bond/rte_eth_bond_private.h
@@ -65,7 +65,7 @@ extern const char *driver_name;
 
 /** Port Queue Mapping Structure */
 struct bond_rx_queue {
-	int queue_id;
+	uint16_t queue_id;
 	/**< Queue Id */
 	struct bond_dev_private *dev_private;
 	/**< Reference to eth_dev private structure */
@@ -78,7 +78,7 @@ struct bond_rx_queue {
 };
 
 struct bond_tx_queue {
-	int queue_id;
+	uint16_t queue_id;
 	/**< Queue Id */
 	struct bond_dev_private *dev_private;
 	/**< Reference to dev private structure */
-- 
1.7.9.5

                 reply	other threads:[~2015-02-20 16:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1424448680-5376-1-git-send-email-maciejx.t.gajdzica@intel.com \
    --to=maciejx.t.gajdzica@intel.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).