[dpdk-dev] bond: changed port_id type to uint8_t to prevent data loss.
Commit Message
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(-)
@@ -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