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 BA7EAA0547; Thu, 29 Apr 2021 15:33:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33DE5410DD; Thu, 29 Apr 2021 15:33:35 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id E3CAE406FF for ; Thu, 29 Apr 2021 15:33:32 +0200 (CEST) IronPort-SDR: CP5ayU8JQgdqCgOuf2lzcbtN3wB1SfQHgl6+g0m+Di4S1E4FTBUcL+JjMndoc01P+bYlbOk6FB +IiW9ElksTCA== X-IronPort-AV: E=McAfee;i="6200,9189,9969"; a="193818676" X-IronPort-AV: E=Sophos;i="5.82,259,1613462400"; d="scan'208";a="193818676" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2021 06:33:31 -0700 IronPort-SDR: l9Z4mcZrNUQiR0BE91KimJkhODIM56dmDLW8wsGdK5rp2uqPRpAn8k7Jc0omc4N1gFUDy/k4ow QF+LIzNmMcbQ== X-IronPort-AV: E=Sophos;i="5.82,259,1613462400"; d="scan'208";a="526943316" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.208.65]) ([10.213.208.65]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2021 06:33:30 -0700 To: "Min Hu (Connor)" , dev@dpdk.org References: <1619083366-63417-1-git-send-email-humin29@huawei.com> <1619487643-27708-1-git-send-email-humin29@huawei.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <784170e4-7bf0-adf2-3d60-8472603802cc@intel.com> Date: Thu, 29 Apr 2021 14:33:27 +0100 MIME-Version: 1.0 In-Reply-To: <1619487643-27708-1-git-send-email-humin29@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [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" 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) > --- > 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( >