From: Declan Doherty Date: Wed, 17 Dec 2014 11:46:57 +0000 (+0000) Subject: bond: check bounds before assigning active slave count X-Git-Tag: spdx-start~9908 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3b6581a3d3bba2a08355606bb09437759729ee5c;p=dpdk.git bond: check bounds before assigning active slave count Signed-off-by: Declan Doherty --- diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c index ef5ddf4379..b1247847a7 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_api.c +++ b/lib/librte_pmd_bond/rte_eth_bond_api.c @@ -115,6 +115,9 @@ activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id) if (internals->mode == BONDING_MODE_8023AD) bond_mode_8023ad_activate_slave(eth_dev, port_id); + RTE_VERIFY(internals->active_slave_count < + (RTE_DIM(internals->active_slaves) - 1)); + internals->active_slaves[internals->active_slave_count] = port_id; internals->active_slave_count++; } @@ -144,6 +147,7 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id) sizeof(internals->active_slaves[0])); } + RTE_VERIFY(active_count < RTE_DIM(internals->active_slaves)); internals->active_slave_count = active_count; if (eth_dev->data->dev_started && internals->mode == BONDING_MODE_8023AD)