From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0042.outbound.protection.outlook.com [104.47.32.42]) by dpdk.org (Postfix) with ESMTP id 91C9B326C; Fri, 7 Apr 2017 16:40:01 +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=3aaXvvSuVM2crP9NgMAQnyyv4UHGhEieUnKrSd4dvGg=; b=XwJ/M5cZFIJk79L9uo0NCV+HsWgZ4fddkOhssqKr6JRNcIO+cUXAOWOg+gmB5BJLmyQ97npv55oCUdXE+tZ8HnpPai2vz/GZPED7aLRuAZo6cB2ZE4T364TVdUuyyWV7z7OB3PACB/db7Mf9rFOrEMBvNYpaZffVMfEz+mSa3UI= 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 DM2PR0701MB1181.namprd07.prod.outlook.com (10.160.246.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 7 Apr 2017 14:39:58 +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: Fri, 7 Apr 2017 16:38:41 +0200 Message-Id: <1491575921-24883-1-git-send-email-marcin.wilk@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: VI1P18901CA0004.EURP189.PROD.OUTLOOK.COM (10.173.66.142) To DM2PR0701MB1181.namprd07.prod.outlook.com (10.160.246.23) X-MS-Office365-Filtering-Correlation-Id: 32e2a7c0-c7d0-4e8c-3b79-08d47dc3f80e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM2PR0701MB1181; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1181; 3:5PM+I2UrQCbqvn6z6+MNLRYeHN1SlLNj5QubPm8qFpL5lU3t490ttsT/RDOoaMYksD7jXdnNlqVRbAfwyjyOS2CXTb5tyEIMcS13trVMPunx2rdtTI/pfIaC+5hlm9SbuDPLU3RJIY1iVUyHRsnvk47UZ6xfCgV+0s8UGOgnmRrkfTCEE292Ch8ttVwy8No7tsosMUvq8WU+fco8hAx0Yc0oWULinPk7qa0UCBUwRxMb4mezeMFJXJznr0SEwdt+JMqGHZeF0pNFjJFwcvPIfP2vdSLGScYGU5VgB5AyhqrXqX1CWGamsez5EU1XbbtmwgwcINQy/uNd//L2Zvhe0Q==; 25:MT47aQCIbguTaLN1YuG2IIyhEVgTzFStzyDs8jDe++kHfn2d6nxqORLo/DFh7ylh7D3nblFlD3/jEQ4pqrkb9+m0QU9o2tXIA3Dlr13pzJeAcACjN8+xDa1YeKcY5qSr8axQqA4ASSUysvSCZ5hgzUMNdE2tMSZ9kG+6a4C0gzVI/mvLmNPiwc8RqlkuD6q00XDxhHCczg0VTseYS3uX98dqO7lAz+Tj00Yya5x7/ycqPaTvWOEng/BRbsc8GyXGgRAbWJmjsIJ6SVI5VVTvcpT9DYewjclu9FrB46ENUSZ3H4OXOknjcOBiynj3PUG0RF5LhZwoPT8QsaVsf54qCK253yo8er9TuzmVaKl9iN2gceLxq2UAN8ZFvdgAsFsNbV4XnRw3YHNmxVB3WFGGGVJ1pcvb0V+FAa3gl6rTIz2oj4Mk5E+XvWPSJ7+35ds78gv5PgDtNCXZxmcF+HOMWA== X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1181; 31:GFq5GYPYZGm4GYH4c2e1NxZaSNux5rAfJhTnzqLVi6PvvRdKx5v9ap4PUQ/FFhHIH3Ix5leMAbZb8OL/yTXxby0ohIntKd2PGs0YPRdYLKFBIwJDaLGvw5pdwLKTNGotZTd5JnP4Rb3U6Uq5Pr7g+8CnUbllsGgvahdxc00k+7xYvIwmH7UXGbFVq2nqhL9/ZijICyh2EVTv2w3MvPL4sb+It8bmQfJde0r3v+RC+nA=; 20:V4q42U5iTjecArPSpbJ9zA0EoU5nyTymHjyR2FknzzYuqrd2cy3H937H7yGXcid4mcT10jTjSoMDwdDoi3BaKm0tZSXs5EQQQLl+EK8HBUXSle9w+9EuV/gCaNYVjDiTVZvszSo2ZAK9bUrWOPRJygdXIeEuh+6snghKHYolDmWdJagczE8D/ojxd86bX/AyRHosBz1CAvpK1pzeGu3DK0W+DwN88Qe8zIpUw1j9jL9L+SCNkKHtb6TffAlObBECu0b/P2ZlhFVGxYk4n144eEPN+zqnfi82Vgl16AHUPduJwEiQwIDCI/dMYeeCR6NsXZMw0TOtI5er7YGI+OSpD/j1UxTG/fVr7p7JZUstFXJWAZCxqGtmqPmQP3YPLERhWXFYBT9SI0qigcVeGB1zL4uX2kByzx4xGE+oeP8Z7V+yMflL+u7fJZGb6yeFDj3KMCJI2BHaR2URr1YFZ5YTnnm5Eo+l8WDgUptICw2DUxE/qsYectM6Ka+Xk6nM0vQBXLKTxjYH9XAQAvXPhvGI3BCKk+tTIgImogGWR/Ak+9BwwlJ4abL7DikUjdbk2biucX9jPlrujhiSHiZal0rEO/Dv40698Fj790MPDOPgpgY= 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)(10201501046)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:DM2PR0701MB1181; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0701MB1181; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1181; 4:raErowPur/OSe4c/WvoDrPsz59jE+Lk9zhm8Q3kPhtu49WEbFsvlNebRWWD02DypK2EBAd2ejuKtQa22wItIPydg+AodoISexnkaLslJJglYovNdmGoVPo8Dqixix05XF4no8WEdu8D3Mv8hfAJsDK+qDWUZHG8QAiexu0GAcFfvjkMdeCvno+fzQKmACArZuvm7328YlFJynf421Gq+FVUrTxzR/koooZ24Tu9SBFMqvWe6vmKcLodftm2+/1qqKxGaZaoRz49rabXCpx6kYGCC35dgPFwNyfLN5ZiasVYE30CX/CeoR/W6fnpJkmrwgSFq52R+mgQlcf13ME1U3fAOeQlTbTKN/6w+6D8DRU4kj04y5GtsVo8wpqx2DMhyGmGqF2Ci5HcEqZYhurrUQY7ikWJzdz6k8RZPfoKTotighYqmAJo+7z+j95ejatsTXXOvJNWJoOZ1m4xzGlaj75o0W93FMjLn97yIvEE3Km42PAZkDD2bwyOOslBa9SVXm45jVEee//xLgX7BfV7Y62zZ3s8m4YN+kMIUlBjM3LiJ1VPmO9qKlwTlXLGnBrl2/0IFxzPwhPg1CWGWEsPt+iKd+ZwtN4zvK9Ma2Td6lldyM3nGhy2/uxPHPMPoqcqTrbst1ynFxjrU+juu3HshHXoi23C6n9ArH42xHpv8vwh5EYU4yXN0MIJmYB4BBZv0 X-Forefront-PRVS: 0270ED2845 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39840400002)(39850400002)(39400400002)(39410400002)(110136004)(33646002)(38730400002)(50226002)(107886003)(8676002)(66066001)(2906002)(6486002)(81166006)(6116002)(5003940100001)(6666003)(50986999)(42882006)(47776003)(53936002)(5660300001)(3846002)(6512007)(9686003)(42186005)(36756003)(25786009)(48376002)(189998001)(4326008)(7736002)(305945005)(450100002)(50466002)(85772001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0701MB1181; H:mkw-System-Product-Name.semihalf.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii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tAUqi8abm18fYuEbT/h?= =?us-ascii?Q?ksMpps+WnCqodLnmsajkeZ31PJZOHkZtA2RoR1on8rks83lrAaYE+L57mNuR?= =?us-ascii?Q?QkA9WnES0CjSFWxyttpH/jHQYo8oKUvMsQJO4Ey65Gu3mDYtUYYuZ4OlusAJ?= =?us-ascii?Q?ME8X1MXbVVkH9iNpY8zFWTvgh?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1181; 6:7G1OR8vSCxVdiDK1f10rBStCMwNSJwzYq8ioxxfiO/4EfUCLMQAUCxYL34K4Hpc4a/271l2SXkCGme6SpEU5ogTNZ1OBNBwYR3+n/mBDJXOQR2FlQMH9uIGKj41xtXZ8nZtjrKKw8xCuz5Oh0ege6sg5r9/NoDHYrQzGYmOEd2AYtASCVyJPP0cEmxvGt+BrDpc0BIdmC+kVN+bDefksFZA15KuvsxF+pbsxWlbG+1hGp3/VL2FfOl6jqpiQ8gEviH9VAj3p7+GgItTVnmeBcNDhuV5y+gUiiFP7NdGJ9dKtxw1HV37Rf8mwmYjhYstS0qAp0IKneKUZ8jZq0k/LF1Wu1qypcZsIDKAZlnzXNLeUof8b/kUitUkUAONTNcechmmQhpv8EoewrTGt11qa01INumhM4kn74yhtb5F8cr1IJDZJeK5ilfN/5kXH+scC75uUKzTn6LMNALFNgWcxIg==; 5:0NH99htR6v+YATzJflOZncxojETWW+ozM8sg5l7W3YQGFHK5ggK8RUBMXPa/1+jaTKRZN1er+5jP/T7U3NYpEQyag/1F5oxEDHFF6y7Cj/kH6/KoCTIlGxeAHK+GxKZ4hqMJtkrIIaeOgb9CVk9K4A==; 24:JS9T5zFkSwUCDQwK3pzLgOqJIm3NcCAwT1TkT+rUseHunZtdHUISWCJz4HVSAaOB7BUWuUaaEV/8ykzlX3Lz5kqDQuuGv0u0dpAZWlDnGdw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1181; 7:hYjv3PXwbsYkwgciUYxtCHJkOPVuhtbDdmLdW0LI/VibCjSK+z4dQJhrP2EnhnJp2gP8cHdu28ptwUleIYrATBlI4/snqkdzDCFAjt65X6OPMfMWs4cgivmcOFeUoYjcazLPlUHwzoiow2V3YWprwqRLwxnxm1/XyBtwtJ7kTm9ZAQpOG1XzyAAqNRvcxmLEQNCrTeJeX/JAPQzIfnhiG+boAZy+FqjFPfj15JtYbZPQpj8fTpPAC0HiqAWtGIe+X0lsxYPuhMbBeuS+0EM6dKe7Qn0yPCCtMiK4q7GJQhcbg7Yjfwo5wsiE3ScVsl4LRPb0LdeeS8dbqCKGaPjlIQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2017 14:39:58.9703 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0701MB1181 Subject: [dpdk-dev] [PATCH] 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: Fri, 07 Apr 2017 14:40:02 -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 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) + 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