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 945BFA09E4; Thu, 22 Apr 2021 11:22:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FAAE41CC5; Thu, 22 Apr 2021 11:22:45 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 5A2034069D for ; Thu, 22 Apr 2021 11:22:44 +0200 (CEST) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FQsMk0nj9z7vry for ; Thu, 22 Apr 2021 17:20:18 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 17:22:33 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 22 Apr 2021 17:22:46 +0800 Message-ID: <1619083366-63417-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] 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) --- app/test/test_link_bonding.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 8a5c831..b5a6042 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -2216,7 +2216,8 @@ test_activebackup_rx_burst(void) "failed to get primary slave for bonded port (%d)", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_slave_count && + i < TEST_MAX_NUMBER_OF_PORTS; i++) { /* Generate test bursts of packets to transmit */ TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[0], burst_size, 0, 1, 0, 0, 0), -- 2.7.4