From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Kiran Kumar <kkokkilagadda@caviumnetworks.com>, <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping
Date: Tue, 10 Jul 2018 18:54:08 +0300 [thread overview]
Message-ID: <726ea484-db2b-72cb-f94a-f9cf1c08b769@solarflare.com> (raw)
In-Reply-To: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com>
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 <kkokkilagadda@caviumnetworks.com>
> ---
> 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 <arybchenko@solarflare.com>
next prev parent reply other threads:[~2018-07-10 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-10 15:26 Kiran Kumar
2018-07-10 15:54 ` Andrew Rybchenko [this message]
2018-07-11 8:41 ` [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments Kiran Kumar
2018-07-13 22:10 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=726ea484-db2b-72cb-f94a-f9cf1c08b769@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=kkokkilagadda@caviumnetworks.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).