From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0046.outbound.protection.outlook.com [104.47.42.46]) by dpdk.org (Postfix) with ESMTP id 703932BB0; Tue, 11 Apr 2017 12:01:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UkbCKxR/OLJP2yjWr2fPfaAt3X5iU0BfPhwgmxWVUgc=; b=MhcohPRXfwuES4HqSnx5j82bMxgZVpEKosbh7ePuu/xEakO1fJpoZIWt7QrWa/QGZfaiMyWHonXJVgRoONc7X7s7Se0BseaVMHN83donzRm1w8hlEJYsWF9kNM61/Z1c7JNQjnhXriUm1Dm0RojqEi+rhrlkThNeA4ZqqTL3D2Y= Authentication-Results: caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin (14.140.2.178) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Tue, 11 Apr 2017 10:00:56 +0000 Date: Tue, 11 Apr 2017 15:30:44 +0530 From: Jerin Jacob To: marcin.wilk@caviumnetworks.com Cc: maciej.czekaj@caviumnetworks.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20170411100043.GB9935@jerin> References: <1491575921-24883-1-git-send-email-marcin.wilk@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1491575921-24883-1-git-send-email-marcin.wilk@caviumnetworks.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0114.INDPRD01.PROD.OUTLOOK.COM (10.174.208.30) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: a30af18b-59dc-44bf-fad3-08d480c1a6f9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:lZmfqA/fVsAFrWEYg7AeWNeis9Pgv08iRHFuuoljYWxN8aLkv5mwhGe1PjjSsGxa57ajpvYLX5EwtjKNvShBz/BWpV4Iw8e+Z+AHHgYBBGuOFSto7PvoNXXkGMh74kuf/r4h9YS0TwItj7sUwc3ayXOzo1VzXJ8Vgxf/Q2LuMIBJSfQGM/rmPe9WQKk/fy8JI9Syodtc7tD61u8xYQavEHhAkiNSlQwbX0/yBB+xdS16UVfXUy+o/IhMwHyxyafXdrajfHVIdQ3QapohQJjgww79M1+BhKK/wW/gzlaWtgkoonJJCzOtVReWvkeFeXuA1AU/gD4t/lfr3Ivaeai7Tw==; 25:mgozX26zQOu8FLingb1KMyKk2Xl3PIcIiozIMa9GmKzbMNdcgedrI+cj3N78+2/JhtFl8IlvM16d7/7w2d6ZMIdD+gFERp9IcEFz87t5xTIhw4EEPaCmh86qQwNP+ozbc5dkNdTLfrpqv3cBzhq96c6BLnnV35O/yaCTOb4H/c71adqoFIF2Ys5m6jyqe9qLlW0AMstbKVA3WCI265KwKuTsXcpo4BNNhWkJUTagUP7hBbhpbKAKdGa7OOlU20CXtNfWRf4+mohKaBUQhli1V3j72DUmThnzwppxWn2yG68PzLk72fNKSwVm1Xs1Z9Od1Zc8cpY/M7dqVR8E2Thjl3mT2LpSzOVQ/NyvOoU7oZnB3h8jAlYSw6+/y2/IHZqmesCWY/tsXEPMUZF7nDguHgKGqUA1Eb/lpYqWGoWY+jeXtB2/xf8JYr63hfZtABszkcz88sZ3KYemTde7YsSYJQ== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:LIlapVwVYF3+AbAL62LaOykmlpd4nJFQF3eVyuoBPAOD7isQYlMD2bV5AyfuiNpysCnlZ5ltDWYRfcl7RlhWrDZThMNf4LLD8ViZf2aRPH2ZVKLI3KXrACznB6Gk7oCazsLlt1A4IbTBSreeNpDHuiRlfCmoxFNR7XOyCtlhCNYWZ0irLcDZNKMlPJJgxle8da4B5F0UkumVVBRvpbwidmPy+u8rp3wCmWbr5+YUWqY=; 20:ZHk+2Ty8XG4N3VEoeJ9dEviUabCtavVYa63RB21iyhwh3W1GL+FqyG7AeIaxbejJFHxFhpCxQJRq7djONWUvl+wAZzF1UXKce04+akR1IsGy60bvQNX8GoIyeNT79njTinrtK66vKjGQs1vijTkCQdGEEuZu+Xr7QXZ7IaH2HkllpCS4cS1hBc0klst++qvGmzvuQXulop7NjEzmd5fglqLf0sxKYPueQ+T6PV1i+xy9CaZrfWmMbdpccD5XhJuuEj0WPpnLYH5HbCCCciyL47KK7R4QsZTYayNPZBC483A5V44NShdWRYWosQJtQJX/5muOFvxYh4yD45i0UOD88ChHb826mW9FEIZ3XvYaBXUjJg4TDcS0EHTBmeOnJY6OVhxrXGI70+sp/R4ujB8n2mX96L39L+Qjb3wXy4wBV/+3N4ia7EqAcBxsOwBr+g0/dJqV3ooTQqFQatIzmbHOdZVaYu09j8bP7p80l5CsQxycbhUCugqtGg3xrxlgFVO0Jp05bkKcbeVsjwflQvimTYMLa/7Ib7BAqN+Yx4ftxWU4W/csGr/rv4WKUNuA3+hxFBSSkhE6HGTLfPNB4W6RqQ1znSwgncSfpSKtrns2HM0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(6041248)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:w2ETXvz5Cb0f7qcj5rN1/63Lv0f39nA2s80GIx9WodCqEM0WhAJhTgGhSktLvjEvyQVqSsmzjNMQseTu6OoA9lLid7Z4PTDfMwGIwAsfIhEsoiqGBOf4n6BG3qIRdXl5fu3vVhJkwimtNucdMG7ROEhke+lPfKqLTfH/ZHoCEOBEENB7/ZV6NXoyKsssUlZoxChp+zevhr+KDditpiZtTkkzoby+RYZkLTCX7nskUvB8Ag1cV7jM4FQZhM7bykD13V2SK5WNHJ+4yBUvT5RAZ4wYuGU6uOfvwxztd9eL26PvordL/xNflhzBgfbZrzuh0kgKqBqrDl2nX3m8yGGeFcNymjpBkC+eVKuKKAPY3QCp78+mPAm9EWYQLF+zia5b/+hv8D2zEyPbaohhTlERsLJb3miClzxjXV2+pu/5rhJT7J7Ik10hjJcO4N/8YUJqjIpLK7zPTaMo5k+8XVicm56Na+lVpxHYCB5LwdrRhMb8jKBNfiZ4mcliaVlxIWMC8XnY7pW//mP3c0uJqD705IbIdo8zTi1ogMSGYXmLdbse2/sMW63BL6Zm3QkFr39GdPtN6Ie20UPWkKi1RcA/oOvWExTiJUaxn69IEDcrXDc1Aky+MFvRBoMPhrsEAqKdXAUc6VPtC9ce57Zqak643G3lD1qlB+e+Y6AxJ4SysCJI6/ol3M/kHFllzBBmuubz6BOI+lX01h8sTr3z9qEfHA== X-Forefront-PRVS: 0274272F87 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39850400002)(39410400002)(39840400002)(39400400002)(13464003)(33716001)(229853002)(6246003)(2906002)(6496005)(55016002)(33656002)(110136004)(450100002)(9686003)(53936002)(6636002)(50986999)(6666003)(42882006)(76176999)(2950100002)(54356999)(50466002)(66066001)(47776003)(38730400002)(4326008)(34206002)(305945005)(189998001)(3846002)(81166006)(6116002)(5660300001)(8676002)(42186005)(7736002)(2361001)(23726003)(4001350100001)(2351001)(5009440100003)(83506001)(1076002)(25786009)(110426004)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:jerin; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:1II7ZuxHSzeOOpL2e/Kn88UTJtZo412G+gpi7vM?= =?us-ascii?Q?ue9Cp1L9velbmarD9Avrn2ZiJseenNF5YYjSjST18S0Sl7eHaf5QR1ffMExo?= =?us-ascii?Q?FND0pVbSfEk7p0AWh9a19hjZPy0bi5EWHzxaKGAXLfZHK7FsbMf1tWy+TjoI?= =?us-ascii?Q?ge2nauEFYtItAHzFgy8pkOeZ7Xl8/+s2h76a1tXunlW3ibqXQ+hE/4988Atz?= =?us-ascii?Q?eZgyNSZO8lIG09zFLos07QL/45NhtTdmuXK6aWXx5pZHt9CQqFuO1+EIC4b9?= =?us-ascii?Q?17Yqg5TpW4AzXiscvC5lKjVay04gJuLGo+7T4xN1wWqDFIUcc7qZtNDiGiQS?= =?us-ascii?Q?4Rm2Qg1q/d2xEdLJ2YggDX8rxJtvjx/b3DGBgbOr55+4xFG+zFczzaKnBwvC?= =?us-ascii?Q?lCAA1SzOzyIBjFjaJRG6+5B1zb+3TR92etZu96PGJs2DypBj3QWjccpGI1AL?= =?us-ascii?Q?9zMrsV4ufH0EsfOiaUhJiGeEfhvRtYVszH5/DBfHhOOk/4G+Mstm2/PDbD4u?= =?us-ascii?Q?+4LlVy6XrwCGopTqnB0OU9TxvnetEMqGrWP1NzBIHPA/DIvpz/2ifJ9fWqDV?= =?us-ascii?Q?RhFXuuRzX9ZtUIfAveYA+VygaHQHho25EhHvO7hZ0FYvPfvR6XgjFBv7paAl?= =?us-ascii?Q?612/uW/9Zj+gNQOTeJQ7SZ4SFSj1UgSTop5LL6vwwl3FjMeSWdEwtKuXM+WI?= =?us-ascii?Q?vMI/hZ16w2JT9OMo1XseoKDOL77k4qA86tiXVcAf7DIiSNTEbwo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vqfB6VYi/pt+6Co9O6JcQkeVx/XhA8FSIrHCk8+8oCKEGe4d+6ZmmgiWmq5jo075MnPCLap6pvTm/PkG9e2cKaCdPbiBg==; 5:uMMSOwxH4YRjcqp7MO/GI/0NHwptfeVeiRt5afMo4NfTjyU67bIvxbCkPXXOCoU27Xr05Mm0P3lmYAw9SmLSXrp622y4PkdGXojFBdO7LpCsZdJv37CW7fdUYvLslOk5g2faT3Ww3wuLIfFUNFQsp+Wqq427gFo32ohnRdmI4dc=; 24:3DEQLGMYqIUHbiSWMqyY3FsfURtmf/sVqhnnDNUWepwj5ORgFeyGyCa9XRq51U5qZeYCT/UgVtLRNJwGClhybw2S+f+iVBe7BWnwaw0c3gE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:/qFqJMABnG+PMb5S3XCXBycMr16O1CQFwHbpLDnHk3Maaro3Tb/3YITPB3hRCAAsMCTMKoDakQ8niwHpceWGSpGUD8mRsAFfcyDAT1aaeb/Fp7wdo2PZC19bzLT0u/hP/ayVr7qT+9tftz4IXn0XVR/3NLbQfQ2oEUXkK2MGbrjOUAImXX6BVhb8ZKBy7dkHhwUchbOzY5HWy2o6/8S33UGMO+1ZIk8UtwvXPmbx1jYmwNH4ZLwCjvFYHO4/mkrm2w2mxwxFeJ93gy2/Yjb1l3X2pvSbiGLlUcUbbkpEKl6KJEeTyk9GLqH9dpxp22Hyq/6SibskZb8OvN4ZIZesog== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 10:00:56.0284 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: Re: [dpdk-stable] [PATCH] net/thunderx: fix access an array out of bounds X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2017 10:01:01 -0000 -----Original Message----- > Date: Fri, 7 Apr 2017 16:38:41 +0200 > From: marcin.wilk@caviumnetworks.com > To: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com > Cc: dev@dpdk.org, stable@dpdk.org, Marcin Wilk > > Subject: [PATCH] net/thunderx: fix access an array out of bounds > X-Mailer: git-send-email 2.7.4 > > From: Marcin Wilk > > Trying to assign more queues to stats struct break only from one loop > when the maximum size is reached. Outside loop interation is continued. > This leads to access an array out of bounds. > > Fixes: 21e3fb0050b9 ("net/thunderx: add final bits for secondary queue support") > > Signed-off-by: Marcin Wilk > --- > drivers/net/thunderx/nicvf_ethdev.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c > index 6c3670a..40d6671 100644 > --- a/drivers/net/thunderx/nicvf_ethdev.c > +++ b/drivers/net/thunderx/nicvf_ethdev.c > @@ -251,6 +251,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > uint16_t rx_start, rx_end; > uint16_t tx_start, tx_end; > size_t i; > + bool breakout = false; > > /* RX queue indices for the first VF */ > nicvf_rx_range(dev, nic, &rx_start, &rx_end); > @@ -289,8 +290,10 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > > /* Reading per RX ring stats */ > for (qidx = rx_start; qidx <= rx_end; qidx++) { > - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) IMO, adding the qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS is much simpler than breakout logic. With that change: Acked-by: Jerin Jacob > + if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) { > + breakout = true; > break; > + } > > nicvf_hw_get_rx_qstats(snic, &rx_qstats, > qidx % MAX_RCV_QUEUES_PER_QS); > @@ -302,14 +305,18 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > nicvf_tx_range(dev, snic, &tx_start, &tx_end); > /* Reading per TX ring stats */ > for (qidx = tx_start; qidx <= tx_end; qidx++) { > - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) > + if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) { > + breakout = true; > break; > + } > > nicvf_hw_get_tx_qstats(snic, &tx_qstats, > qidx % MAX_SND_QUEUES_PER_QS); > stats->q_obytes[qidx] = tx_qstats.q_tx_bytes; > stats->q_opackets[qidx] = tx_qstats.q_tx_packets; > } > + if (breakout) > + break; > } > > nicvf_hw_get_stats(nic, &port_stats); > -- > 2.7.4 >