On 4/27/2021 2:40 AM, Min Hu (Connor) wrote:
> Buffer 'test_params->slave_port_ids' of size 6 accessed may
> overflow, since its index 'i' can have value be is out of range.
> 
> This patch fixed it.
> 
> Fixes: 92073ef961ee ("bond: unit tests")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
> ---
> v2:
> * fix bonded_slave_count value.
> ---
>  app/test/test_link_bonding.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
> index 8a5c831..f8abb22 100644
> --- a/app/test/test_link_bonding.c
> +++ b/app/test/test_link_bonding.c
> @@ -2216,6 +2216,9 @@ test_activebackup_rx_burst(void)
>                       "failed to get primary slave for bonded port (%d)",
>                       test_params->bonded_port_id);
>  
> +     if (test_params->bonded_slave_count > TEST_MAX_NUMBER_OF_PORTS)
> +             test_params->bonded_slave_count = TEST_MAX_NUMBER_OF_PORTS;
> +

Hi Connor,

Similar comment as previous version, what is the root cause, how
'bonded_slave_count' end up being bigger than 'TEST_MAX_NUMBER_OF_PORTS'?

>       for (i = 0; i < test_params->bonded_slave_count; i++) {
>               /* Generate test bursts of packets to transmit */
>               TEST_ASSERT_EQUAL(generate_test_burst(
> 

Reply via email to