From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] bond: changed port_id type to uint8_t to prevent data loss.
Date: Fri, 20 Feb 2015 16:11:43 +0000 [thread overview]
Message-ID: <1424448703-5483-1-git-send-email-maciejx.t.gajdzica@intel.com> (raw)
In some places port_id is declared as int, which causes data loss when
using functions expecting port_id as uint8_t. 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 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index a8df699..3ddba25 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -417,7 +417,7 @@ bandwidth_cmp(const void *a, const void *b)
}
static void
-bandwidth_left(int port_id, uint64_t load, uint8_t update_idx,
+bandwidth_left(uint8_t port_id, uint64_t load, uint8_t update_idx,
struct bwg_slave *bwg_slave)
{
struct rte_eth_link link_status;
@@ -1681,7 +1681,8 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
char *name = dev->data->name;
struct bond_dev_private *internals = dev->data->dev_private;
struct rte_kvargs *kvlist = internals->kvlist;
- int arg_count, port_id = dev - rte_eth_devices;
+ int arg_count;
+ uint8_t port_id = dev - rte_eth_devices;
/*
* if no kvlist, it means that this bonded device has been created
--
1.7.9.5
reply other threads:[~2015-02-20 16:11 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=1424448703-5483-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).