[dpdk-dev] [PATCH v2] bonding: fix overflow check
Min Hu (Connor)
humin29 at huawei.com
Tue Apr 27 03:40:43 CEST 2021
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 at dpdk.org
Signed-off-by: Min Hu (Connor) <humin29 at 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;
+
for (i = 0; i < test_params->bonded_slave_count; i++) {
/* Generate test bursts of packets to transmit */
TEST_ASSERT_EQUAL(generate_test_burst(
--
2.7.4
More information about the dev
mailing list