DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>, <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] bonding: fix overflow check
Date: Fri, 30 Apr 2021 10:54:53 +0800	[thread overview]
Message-ID: <4a93b0d2-5d19-b0fe-e3d3-a47921d96c25@huawei.com> (raw)
In-Reply-To: <784170e4-7bf0-adf2-3d60-8472603802cc@intel.com>



在 2021/4/29 21:33, Ferruh Yigit 写道:
> 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: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@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'?
> 
Hi Ferruh,
Currently, it will not happen.
But if the testcase extended, for instance,
"test_add_slave_to_bonded_device" is called over
TEST_MAX_NUMBER_OF_PORTS(6) times in
"test_add_already_bonded_slave_to_bonded_device",
then 'bonded_slave_count' will be 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	other threads:[~2021-04-30  2:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  9:22 [dpdk-dev] [PATCH] " Min Hu (Connor)
2021-04-26 15:08 ` Ferruh Yigit
2021-04-27  1:41   ` Min Hu (Connor)
2021-04-27  1:40 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-04-29 13:33   ` Ferruh Yigit
2021-04-30  2:54     ` Min Hu (Connor) [this message]
2021-04-30  9:30       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a93b0d2-5d19-b0fe-e3d3-a47921d96c25@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).