From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0040.outbound.protection.outlook.com [104.47.37.40]) by dpdk.org (Postfix) with ESMTP id 3249B2BAE; Tue, 11 Apr 2017 14:35:36 +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=dZI92CyABuEEfoZ7Uy3gRzy6mVeBaYmMg9TaqYwvbbk=; b=QEgQzax/t9ukby8XLOhMzj++53IzB07d9DinltDzTrmrsxUPy3NwaDe8DOPGQJXAn/Xwo8bdzJJifci2p3JvhqqgYnVr2yBCd6kEqjzTVT8ko63tpD677UfojT4JYUB2M7Hs3YuYi3wnULOHJq+r8FhKLUjf7D6PqTLnQM8j798= Authentication-Results: caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from mkw-System-Product-Name.semihalf.local (31.172.191.173) by BN3PR0701MB1170.namprd07.prod.outlook.com (10.160.114.18) 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 12:35:32 +0000 From: marcin.wilk@caviumnetworks.com To: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com Cc: dev@dpdk.org, stable@dpdk.org, Marcin Wilk Date: Tue, 11 Apr 2017 14:35:13 +0200 Message-Id: <1491914113-6431-1-git-send-email-marcin.wilk@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491575921-24883-1-git-send-email-marcin.wilk@caviumnetworks.com> References: <1491575921-24883-1-git-send-email-marcin.wilk@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: AM5PR0701CA0049.eurprd07.prod.outlook.com (10.169.145.139) To BN3PR0701MB1170.namprd07.prod.outlook.com (10.160.114.18) X-MS-Office365-Filtering-Correlation-Id: 572364a9-3a71-46ea-b8c5-08d480d73f0e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BN3PR0701MB1170; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1170; 3:XG2pUOW92M3Bc9xZBTFaxk344LVHHwjJ1BRzOl/tlVAeIyJOtTY5x0pg8tzWDY5ICeLckmMU+fVNvNGzqSrnGEQVIlzufbz03B41bo57LIklDMWHN1MCe33UpC0S1I/wmmrV+H7kErWqkEb4bYTHTbd+/4gBVAGv1gHK6CONZOIUTpejzP3Ra2O+EdPKT+soOMzmqCmvZuWzZ8a7JnGqjymL9X3v6JKmomZLvnhsDBHCDRiQ/d4ZQ9qN2B8QRfwHWOIMft9BL4iH4V4wV3rp8DC3eoniDlByY0II6lglxxe9UflYg5aJ0QpnZ2Eph5M6r77pvE0qhqRgIdI8c11f+g==; 25:xC38/8vXKAIoT57NF0k7G3DcLclh5UeSCu6MySmsBKN4COm++JOMemyvSVfXkQQVcRlpgZe+c5HioOAI+OvOujHpLHkMCI8Iv4kRbEvScuexhxkM3XGzqkaO0Z0ue4SLfS3Ewulk4VUEBlOelrCgRug5yfpIq3I9kb0QVrZo9OzFVLoXv8sqQciz2m4J3YpeQi5J59DpjI6YgW3YVRFFFsrQEXiXJ1XlQzu3arTBdx6Rr6yaVBW8OKKQ2RsMzvPfklvFxj1Q9axp0AwGza1BvWoqm5T2zKfamS91+fusjdxnJTjS7nA5Q5JRyR/QoTVmdpQuq+qXGpngOg6xlxwlRwqLYdElq2wub2awjf17eajx/Wl3lpU43RQGpcflk9z1Q0vukcA9aoE+Tioh6FAsBxrbbbk1TB2lgqz6CYGDlMKG/Zki5u2jRG6+nfTUrIBti+IVAiJScVVVRgqzfiq+0A== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1170; 31:XMI8QYP4X9TrrkQadv5F4uX7hQ/iDxNMIqVmEev2bc4u+LLZd1bn2S+QTL4luezxx+qXTuOqcR0W7mU11OKS3TzIkh8SAS7NBF0k8IVjkqa/lsPeWi0SXBCZM0kFGRKAL16jpfUB76ihkEX6GVNqcapt+02cX4hnSipFZdK8oVVpuKrjtuaXIhQZjo2HtwlGx73sbg0kfNFx+XHCJPIgGtPHx9GD4fDK5+pazFYajaaTb0fQH/G1n02ZtgyQBdQb; 20:Hgd8E7I5CMlEDaMa8opy0wx7Bd81Shxo1kuLfWPcL1ZA0FEXmgX9OFVwmUJafebp2VPcb/l8DyGTb9C9LQ8+ww7ol/8Mg3gxi4/p3w1aeo8hVhrYN4YMARxwyMthyibF2fwnHpIjbiNKWnvaV33WUnZMYjD7cTY5uDwfUEIO3iiDVPyRBbf6hA+turZNwX0ca81LiLsEGQVJexpA/XGcYuAm1VriMoKYyMjTsrdcwf/n/RFBRLeeMztb7PFY330+xYXTqBG+OHPiK0hjHZAB1Zs9zyOYiby1WiJdbcjFQKxwc/DCk5pxG8VJpeGbMnWxbdeLWmAUJ/LSUMUt4Kq0Mj32/vPPuiC8vrmX6+aHgiIf9Y4ZJdAjkSX/lI3B9uKARIl74xOD1CENDcMi2hj/8UmiuuwWHITes/E0Atev8C3IJcti16Cn6hbf1smRTLaWaM8MUffkkGFKDbmyV28EBJJVpK4N0IuReIM3TrTnolS7WgMZ//bFO4gH2lz9UKNZs4/VHkfDQZsUlj4ESqThVmhhcJW5gjoT6NCgLX1UcZuSBTGRFICa+EDHlgt6FT8iM4KGGc1yzKxYv2C/OHFwc4m7u7NYOmx77Xp7BcKZ2ac= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:BN3PR0701MB1170; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1170; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1170; 4:YUOpaRN7QvldInbKTAxzjIrYL7jSo3hQwGSmpxgrc26Tuq+/KGT/gforSOzOGJHTEeuIgtUgtQuJFa4ukAaI2UYXZUUFns885zhf21v1l86BtEPVEnjXz7KfSBKIoJD0saWwhmv9ivk9gcLZ/kNzWg7y3yX538biAWYemycU7fw7WDXOeBZC29bpwNitE4h52h7I2rp3i7esgaewKo7RjYUD6abmXi2zitm9ppyn9R6b3CVWgks5gOO1pXswr058K3CgYYDHhoWsb1oXb4c/vsNEKtqO/vbcXtrYaaUU0sIQRLBOqBsPhr//aLVoQJN5ApiS4++BgVso6ApbDFCOZzGW5jIHUOonWYgxt8WhhP8gKix18wYSbw9CkLtiyO8t6XRRMWfq+Bm97ZLi+wnGPE/fOXMJ2D7xn+oEbgq79/YbeARM47AHXs7NhQONgp2XUgf7i3xeOAiH6Fv3qfaDHLyqNgm5QUQwiAJdwLhI+l1WEDyVud4V7wQ5UbO8h2hAgVffwm44rT7UYQ6YR5SrbVtW7aypbDniBnLLMjIClDG+ObXpRSYWmrHFFBq0LxfZ+6yHB8SEw6f4I53DypXhrPlGalv8ZdHEvPQ87P/V50qXuOhmIGBncq4nitziDmPhpSwlGim3ZKs6pVVJ/QbW/3YxXioolw4IXtZ94Cb4pCBHPRgyf2xsHrCPLZ8F3UNl X-Forefront-PRVS: 0274272F87 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(39410400002)(39850400002)(107886003)(6116002)(3846002)(38730400002)(42186005)(110136004)(305945005)(50466002)(33646002)(81166006)(48376002)(42882006)(2950100002)(6486002)(6666003)(8676002)(5003940100001)(36756003)(47776003)(53936002)(7736002)(9686003)(6512007)(2906002)(66066001)(50226002)(5660300001)(4326008)(450100002)(25786009)(189998001)(50986999)(76176999)(85772001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1170; H:mkw-System-Product-Name.semihalf.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1170; 23:jk5x77T2cbW8u0x946vP8SN8aPcyymznDJWxXce?= =?us-ascii?Q?xJl/e+L28P9XBh2seJdL4RAYH11Xb5Y/F9JD2H9KxS/dqE9Uf2O4FV+Q3WDl?= =?us-ascii?Q?6Dt8zTmf8SJ9SAb2V8T9hLf+oiAebe6nZga2gAkfVSovNvdEWa58MbAoa9Q2?= =?us-ascii?Q?fvwEQoxIFW8jgZpSCGQfPkn/3V3eXuoga+Znc8yyUmdx/wDR/CKU5/yFbX7v?= =?us-ascii?Q?mN115TenR06IJt64s9jy6X17uNrhphSJTmROSe27HvVyalLD3kjPYb0lf5R+?= =?us-ascii?Q?dQjwUhWW76szOKdK68ufueyHEkYTeN26n1XfMoqvJM7j7MAPFAHRuth5Wc1w?= =?us-ascii?Q?RjZQ3ti6vq9QvHtOkFIqvPqU66coK0FEXyXIv1w3VDFvTdww+TsGsWOLkhSU?= =?us-ascii?Q?qre2lTXhawgJp0HrMDGNqNDEa40F5Rj/zkEr6MLIov+GgR0uk7y2skK+dV47?= =?us-ascii?Q?bkTCrbNd18F4G76wLkspoU7rCeYQAr0f4vCjw46PmOqjaPKZNNKukTp6L12p?= =?us-ascii?Q?WXMiuzEJGGYgTHkfSpJ7PMiQoPTtTycn5PCuuQ9rafDhIb77dwA2JjyK556M?= =?us-ascii?Q?9PIfB12o/p2nD0RceLwp5Ac03TKDQexS67yoFBm8CbD1dL3z1kU7/NjwKQPx?= =?us-ascii?Q?VIRa8Mnf9s+SjU7A5ycSw6XsCXQgh3nOirMCGsPxm+L/xXlMv5wjDevCNd7+?= =?us-ascii?Q?se0y9NP86Lkox4DYxuYiCpgnQUCVnyKMQp9hvGTHHSzysP6AmpuPYlWRzssb?= =?us-ascii?Q?8CPG/jHH7//JGbrD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QXhg9mL8aPK8c7nPAX5L/wsEgW2/Vidniabe/BTxYx35PE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1170; 7:WHLiF8OLyfC/w8JMzEvnQUYU+q6HnUMVzdNoQ2qEEnjCvqxZPluor617jto2PCPnGngaI6ZRBSmPq0m2L/5UHjO6c8ffeEuPDGWqkkdyr/1BQ0b2hjcjwqaSCDUeb2F0dF9H/UdnfOxEqSg6kyO+r35WJn+znYE9QHdDMMKokzkoFeiEOn27PePOyOnu4qwA+zuaAo+iPohqB3UpYJ2DhX0VGegqTk6tyUf4A3pzcS3c8aLVJN+iFrQI6aLo852259V1mYtqvaxf/VkSk+tkM0vWV74oH20Ly8A8He/4Y3CcuKzxx+xccyWwiN97PE7mOemLimcSvwIJ2+GluYEHWg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 12:35:32.2109 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1170 Subject: [dpdk-dev] [PATCH v2] net/thunderx: fix access an array out of bounds 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: Tue, 11 Apr 2017 12:35:36 -0000 From: Marcin Wilk Trying to assign more queues to stats struct break only from one loop when the maximum size is reached. Outside loop iteration 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 Acked-by: Jerin Jacob --- drivers/net/thunderx/nicvf_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 6c3670a..27fe93c 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -257,7 +257,7 @@ 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) + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS) break; nicvf_hw_get_rx_qstats(nic, &rx_qstats, qidx); @@ -270,7 +270,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* 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) break; nicvf_hw_get_tx_qstats(nic, &tx_qstats, qidx); @@ -289,7 +289,7 @@ 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) + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS) break; nicvf_hw_get_rx_qstats(snic, &rx_qstats, @@ -302,7 +302,7 @@ 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) break; nicvf_hw_get_tx_qstats(snic, &tx_qstats, -- 2.7.4