From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A06BFA0548; Tue, 27 Apr 2021 03:40:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82AF940143; Tue, 27 Apr 2021 03:40:41 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 662B24003E for ; Tue, 27 Apr 2021 03:40:40 +0200 (CEST) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FTkt82rWNz7x25 for ; Tue, 27 Apr 2021 09:38:08 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Tue, 27 Apr 2021 09:40:34 +0800 From: "Min Hu (Connor)" To: CC: Date: Tue, 27 Apr 2021 09:40:43 +0800 Message-ID: <1619487643-27708-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619083366-63417-1-git-send-email-humin29@huawei.com> References: <1619083366-63417-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] bonding: fix overflow check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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) --- 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