From mboxrd@z Thu Jan 1 00:00:00 1970 From: Declan Doherty Subject: [PATCH v3 1/3] bond: add bounds check before assigning active slave count value Date: Wed, 17 Dec 2014 11:46:57 +0000 Message-ID: <1418816819-13517-2-git-send-email-declan.doherty@intel.com> References: <1418663630-27409-1-git-send-email-declan.doherty@intel.com> <1418816819-13517-1-git-send-email-declan.doherty@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1418816819-13517-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Signed-off-by: Declan Doherty --- lib/librte_pmd_bond/rte_eth_bond_api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c index ef5ddf4..b124784 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) -- 1.7.12.2