From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0076.outbound.protection.outlook.com [104.47.32.76]) by dpdk.org (Postfix) with ESMTP id 3A0D91B44C for ; Tue, 10 Jul 2018 17:26:37 +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:X-MS-Exchange-SenderADCheck; bh=Gfx5sREJx9pjkBenEZTJzczwYfk2O48/wL1vlHO58OE=; b=PDgcBClN+8cuBXyuFsC/M6blBSwsvUdW7EIh4fYTWSRtAo1r+Ig7RIRUzWrAmsn34zMoPCUsUjLWJ3eml98GMN1OU/5leumwTX7RMYeg9S4fRz9Hu6wKdA+MvAefx0/dzEgZyc+6Qu9e3i/se/8Xo0LAqXqRKJlh0K3KhHqBq9Q= Received: from kkokkilagadda.domain.name (183.82.20.84) by BL0PR07MB4946.namprd07.prod.outlook.com (2603:10b6:208:49::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Tue, 10 Jul 2018 15:26:31 +0000 From: Kiran Kumar To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, Kiran Kumar Date: Tue, 10 Jul 2018 20:56:07 +0530 Message-Id: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [183.82.20.84] X-ClientProxiedBy: BM1PR01CA0091.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::31) To BL0PR07MB4946.namprd07.prod.outlook.com (2603:10b6:208:49::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 148dd8e5-8439-4cd4-f6b4-08d5e67984b1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BL0PR07MB4946; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4946; 3:sZVuKqSpkq6LlqYPo/ZbWe3UKk/y6l5kLZRmu7GkNRWooLgSByTWIF9yhcHqEzzMOG1I/xJ+umQU4Wu1VAY4rBV/3NC5r4BPRPjay32idKdYrfTWKFQmDxr559K6miq0ZhFBAVj+ZIOdIUXrBGR2jGrWj3+RbZ3nqPpyC0EYRwn3vYeL4XeItppORyNEHiblHYKniYA4VZQmma5K1yfaYsYeI89Pghu+syN9XoeFavypYw2I/qbX/Nvh10EscLVd; 25:kANYYbqneMR+gaDCdamn6DM1wTCgYZuIKj4UcMAiDR+LBhgDTYqo0+nzp+BErcifbTaYvPs/UEjX/xrso3VGNM/11EIfhO0QhNJ66cQxjfXZIS1cNWrYHA11LmOp02UJnKWCCdhVHKmPi+5sb6pEMnDRgu/5RHLLAcoDt8jHRdCErffCBRil0I2HVNd78V5IUby0UmsnpyT8LDJyIZoYSpKdEa9xCF4KRlmcrNHFA8ban4Ek27lWCz3A3EAKm4GUqMc8ia1O76OW90qP9bNW32BdW1VhlWPFIvNK4wp8mJVXCzEDtjQumziiPsqJVSvZKeDn1os8P2ebIjgAkw1Iyw==; 31:uGAK/d9w1oi91ONK0+DWPI9yBVqxMs/JUv1SdzO3uOM1KvcQ1Az66WHjBGXnzSKCgi1k/XlNGiqBfXa2QEolHkV/91HbwQD/7mgXxXY8HLmH5J9WevXqkeB/vHB6qP+VSjGbwUr3fHiSflirR2zCCWTnBjgK898Wm2GObygIb73dNjfieF6DprNLkAqTKmRkw9lZC94IoigdLlHdOtGAyudOn9XbfFGogGtiZ2KbWmU= X-MS-TrafficTypeDiagnostic: BL0PR07MB4946: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kiran.Kokkilagadda@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4946; 20:VTXF1tfdqmJFnbtJkFkCNYmmFDBQjsD5irA4GeCDAPVLtxzZfPD2KaQxE3i8vd4g0sQ6Jlnm8y+tu4Sxa5AuuWUvBPf0YxjUyChVhrD5o9XgYuB1QqWRnuJwcmKxdeibatLkSB7WIXxnKtnu4K18Qniy5BF9Gn9+gWTySEtQKckJzpLbJZqdwfslgI9woO8l/qmVmuNaxUilPcwlO7Bn6X1AU9eCF7t8E30aPbsZPpVtMLNmwG99W1g30IDg9s76AZ6dZC/eJbukinYhW7WPRx76wo/mn2QNdwHkPMjwhvJthNezK+Yw7A9cjJYJPfqMvJEFXxV4nEKXtFd/2pbxcpO13NDnHQ2ShkGHCToLOPQ4xc3zvkCIzfMYXhogh9tGVcbUlZ8Ns811wSgncZHVUJdT3dDvIVfod9AVBtskWrlrU/3JcGoHEM9Y3OuhSwfm/P4IqxkR7gfycWHSz6y/HphrSJsIe37/jTCZ5S70Na1q82nZlkMvTy/ITYq7nQ/vz3F89vljpHbFEozT9hisJKlmDrqHWY+kMlFzKIYQfvwove92yum2MaBSe4kossAQw0lDbG/7I8CqIef3Gci3BtjOSEpWNOT9D9PMvpfxkIE=; 4:T0GFnghm1MVlwTCk7svVbwTSLJTJq8TS1v+iElgQgUComFQ6ZNcYacYaj59+qY8HPewu2bwmAJiB+2drHeYTmBs3t88txxUVCNpwKNEJO6Uoqc20Ggesnq0YVrU8EQ1/WhQSGLM4Om1+0cPKVeg1mIVXXPLjx/fFt7EfCPuII30Fg29FHoF037ZKBGLVgyu2cbzrGJGy14PnpMSzOZjZCdZ6jG3rA1qe4CNn3ga2CyTNzcdn9CWRISGITfuCm16CC1fUxmd9PE4FjpQSH9+9Pw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BL0PR07MB4946; BCL:0; PCL:0; RULEID:; SRVR:BL0PR07MB4946; X-Forefront-PRVS: 0729050452 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(376002)(346002)(39860400002)(189003)(199004)(3846002)(186003)(16526019)(26005)(47776003)(2351001)(66066001)(6486002)(81166006)(7736002)(105586002)(6512007)(50466002)(53416004)(81156014)(305945005)(2361001)(1857600001)(8676002)(106356001)(8936002)(36756003)(2906002)(48376002)(50226002)(42882007)(6666003)(6116002)(72206003)(6916009)(4326008)(52116002)(51416003)(107886003)(486006)(316002)(956004)(476003)(2616005)(53936002)(6506007)(68736007)(386003)(16586007)(97736004)(25786009)(5660300001)(478600001)(69596002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR07MB4946; H:kkokkilagadda.domain.name; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL0PR07MB4946; 23:dHaGtXPBMx+tq6+yF/6ItUcRlmY9aRfO5FDoOjzRD?= =?us-ascii?Q?RLd6wox6Oop7G3RHNcnPpqAR2Ks6s7P3s5MLM8ArCC/TV24Z0Hmou2cxoTnj?= =?us-ascii?Q?MLdbBElSFTBj97+SE0uSDdV91SvZ3oPeLqpOF4HmFCfzO2qjk9/6MRM4lqgN?= =?us-ascii?Q?ga4QqFZIS1h1i2L0znrhJlFEE7L+eikcwh7w6uOy9gT8WtilnFYf57iaL8ri?= =?us-ascii?Q?QwbBMN6vxzilTkxPyPkB6OkkmtpOcvFer8Zd7wKLgQ345S4hIGePmU4VmNYE?= =?us-ascii?Q?+V2HhZH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3payIMJxzeY6c+FI9Rw+UpWuq9zkGXX3fZDKQVyFQsRydxapDaAI4zv+ZLyQbzW/If+2E7DOqVE0DRhSJuDJ2DoESbmZN5B6exylExu111dF3GVSbwhP5eK6TvTUbq8d4=; 24:qYIbfvFUwFOUTxzLZz8tllGAHW5VYWdUVyszxMTdMFCy1+E7nDTTj0T+TQH8bCHPjjCZ+VeZBOwTmg78dZ5T6sy8yqM6Z1r08GGtIdcztTc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4946; 7:y6F/4lUMsbRZ3PAzzQSECkELD2xK1D5NZTVcVp+YJLl053JoEnfgws8oiXA/uS7GaFTyjfz6yuimTVxs1W6k6yGa2vKZvk1mlCqiamclkW7VpW8NOJ3OuIsFlztsecVzVBNLTsGxV84N1LP11et3S4wrRXHBZRKZG9t/n8Iqjfm2tkX7+VfQlWbHI5CzVSAXk8bREQ8eSwClfiyL2kbcr2KGQ3zUuoqptjSqfUk7OxOzss/hB1s74TYmZ0jnI9ar X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2018 15:26:31.3229 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 148dd8e5-8439-4cd4-f6b4-08d5e67984b1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB4946 Subject: [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping 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, 10 Jul 2018 15:26:39 -0000 With current implementation, we are not checking for queue_id range and stat_idx range in stats mapping function. This patch will add check for queue_id and stat_idx range. Fixes: 5de201df892 ("ethdev: add stats per queue") Signed-off-by: Kiran Kumar --- lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index a9977df..0849016 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2457,6 +2457,16 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP); + + if (is_rx && (queue_id >= dev->data->nb_rx_queues)) + return -EINVAL; + + if (!is_rx && (queue_id >= dev->data->nb_tx_queues)) + return -EINVAL; + + if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS) + return -EINVAL; + return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx); } -- 2.7.4