From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 24A9B5F21 for ; Tue, 10 Jul 2018 17:54:34 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 631F3100091; Tue, 10 Jul 2018 15:54:32 +0000 (UTC) Received: from [192.168.1.16] (85.187.13.33) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 10 Jul 2018 16:54:20 +0100 To: Kiran Kumar , CC: , References: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com> From: Andrew Rybchenko Message-ID: <726ea484-db2b-72cb-f94a-f9cf1c08b769@solarflare.com> Date: Tue, 10 Jul 2018 18:54:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [85.187.13.33] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23958.003 X-TM-AS-Result: No--7.838100-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1531238073-wuvFoOHTpXlP Subject: Re: [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:54:34 -0000 On 10.07.2018 18:26, Kiran Kumar wrote: > 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); > } Summary should be something like: ethdev: check queue stats mapping input arguments Acked-by: Andrew Rybchenko