[dpdk-dev] [PATCH v2] bond: static analysis issues fix

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Dec 16 18:31:33 CET 2014


2014-12-15 17:13, Declan Doherty:
> -v2:
> Incorporates Pawel's comments regarding assertion's check on activate_slave array indexing

Changelog should be below three dashes to be excluded from git history.

> Fixes for link bonding library identified by static analysis tool
> 
> - Overflow assert for active_slaves array in activate_slave function
> - Allocation check of pci_id_table in rte_eth_bond_create
> - Use of eth_dev pointer in mac_address_get/set before NULL check

Please send 3 patches. 1 bug = 1 fix with its explanation.
The main advantage is to help referencing regressions.

> Signed-off-by: Declan Doherty <declan.doherty at intel.com>
[...]
> --- a/lib/librte_pmd_bond/rte_eth_bond_api.c
> +++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
> @@ -115,8 +115,12 @@ 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++;
> +
>  }

Why a blank line here?

-- 
Thomas


More information about the dev mailing list