DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bond: changed rx and tx queue_id field type to prevent data loss.
@ 2015-02-20 16:11 Maciej Gajdzica
  0 siblings, 0 replies; only message in thread
From: Maciej Gajdzica @ 2015-02-20 16:11 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-20 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 16:11 [dpdk-dev] [PATCH] bond: changed rx and tx queue_id field type to prevent data loss Maciej Gajdzica

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).