From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9D7A4236 for ; Wed, 20 Sep 2017 14:04:50 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 20 Sep 2017 05:04:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,421,1500966000"; d="scan'208";a="154004761" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga006.fm.intel.com with ESMTP; 20 Sep 2017 05:04:47 -0700 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Sep 2017 13:01:30 +0100 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.167]) by irsmsx111.ger.corp.intel.com ([169.254.2.30]) with mapi id 14.03.0319.002; Wed, 20 Sep 2017 13:01:29 +0100 From: "Dumitrescu, Cristian" To: Rongqiang XIE CC: "dev@dpdk.org" , "Singh, Jasvinder" Thread-Topic: [PATCH] lib/librte_pipeline:fix the array index out of bound Thread-Index: AQHTG95nNQtGbKLPs0ya9pbuJHepUaK91t/A Date: Wed, 20 Sep 2017 12:01:29 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891267BABCE0E@IRSMSX108.ger.corp.intel.com> References: <1503471932-22577-1-git-send-email-xie.rongqiang@zte.com.cn> In-Reply-To: <1503471932-22577-1-git-send-email-xie.rongqiang@zte.com.cn> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] lib/librte_pipeline:fix the array index out of bound X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Sep 2017 12:04:51 -0000 > -----Original Message----- > From: Rongqiang XIE [mailto:xie.rongqiang@zte.com.cn] > Sent: Wednesday, August 23, 2017 8:06 AM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Rongqiang XIE > Subject: [PATCH] lib/librte_pipeline:fix the array index out of bound >=20 > In function rte_pipeline_compute_masks(), the value pos equal > p->entries[i]->action,type constraint p->entries[i]->action is > [0,4],but array action_mask1 size is 4,it possible attempt to > access element 4 of array action_mask1.And also in function > rte_pipeline_run(),it possible attempt to access element 4 of > array action_mask0. >=20 > Signed-off-by: Rongqiang XIE > --- > lib/librte_pipeline/rte_pipeline.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_pipeline/rte_pipeline.c > b/lib/librte_pipeline/rte_pipeline.c > index 7f8fbac..2914445 100644 > --- a/lib/librte_pipeline/rte_pipeline.c > +++ b/lib/librte_pipeline/rte_pipeline.c > @@ -155,8 +155,8 @@ struct rte_pipeline { > /* Pipeline run structures */ > struct rte_mbuf *pkts[RTE_PORT_IN_BURST_SIZE_MAX]; > struct rte_pipeline_table_entry > *entries[RTE_PORT_IN_BURST_SIZE_MAX]; > - uint64_t action_mask0[RTE_PIPELINE_ACTIONS]; > - uint64_t action_mask1[RTE_PIPELINE_ACTIONS]; > + uint64_t action_mask0[RTE_PIPELINE_ACTIONS + 1]; > + uint64_t action_mask1[RTE_PIPELINE_ACTIONS + 1]; > uint64_t pkts_mask; > uint64_t n_pkts_ah_drop; > uint64_t pkts_drop_mask; > -- > 1.8.3.1 >=20 >=20 NAK Hi Rongqiang, Thanks for your patch, but I think there is a confusion on your side here: pos =3D p->entries[i]->action can only be 0 .. 3 (and not: 0 .. 4), as the= last value in the enum rte_pipeline_action, namely RTE_PIPELINE_ACTIONS (e= qual to 4), is not a valid action, but the number of valid actions (which a= re specified by enu values 0 ..3). Makes sense? Regards, Cristian