From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id CE0631F7 for ; Wed, 17 Dec 2014 12:47:06 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 17 Dec 2014 03:47:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="500145891" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 17 Dec 2014 03:42:48 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBHBl32c009849; Wed, 17 Dec 2014 11:47:03 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id sBHBl3eq014484; Wed, 17 Dec 2014 11:47:03 GMT Received: (from dwdohert@localhost) by sivswdev02.ir.intel.com with id sBHBl3uL014480; Wed, 17 Dec 2014 11:47:03 GMT From: Declan Doherty To: dev@dpdk.org Date: Wed, 17 Dec 2014 11:46:57 +0000 Message-Id: <1418816819-13517-2-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1418816819-13517-1-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> Subject: [dpdk-dev] [PATCH v3 1/3] bond: add bounds check before assigning active slave count value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2014 11:47:07 -0000 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