DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@mellanox.com>
To: "20190311181544.15646-1-stephen@networkplumber.org"
	<20190311181544.15646-1-stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] ethdev: check for invalid device name
Date: Mon, 18 Mar 2019 12:32:15 +0000	[thread overview]
Message-ID: <VI1PR05MB42692398CE8A62DC2DFD2284D7470@VI1PR05MB4269.eurprd05.prod.outlook.com> (raw)
Message-ID: <20190318123215.m1cBdw8PNTZDtN__Jb1mxwyD6sGjm2jl3Zety_rDTzI@z> (raw)
In-Reply-To: <20190314162047.20375-1-stephen@networkplumber.org>



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Thursday, March 14, 2019 6:21 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v3] ethdev: check for invalid device name
> 
> Do not allow creating a ethernet device with a name over the allowed
> maximum (or zero length). This is safer than silently truncating which is what
> happens now.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
> v3 -- fix whitespace issue
> 
>  lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 85c1794968dd..cf69daaf3224 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -438,6 +438,18 @@ rte_eth_dev_allocate(const char *name)  {
>  	uint16_t port_id;
>  	struct rte_eth_dev *eth_dev = NULL;
> +	size_t name_len;
> +
> +	name_len = strnlen(name, RTE_ETH_NAME_MAX_LEN);
> +	if (name_len == 0) {
> +		RTE_ETHDEV_LOG(ERR, "Zero length Ethernet device
> name\n");
> +		return NULL;
> +	}
> +
> +	if (name_len >= RTE_ETH_NAME_MAX_LEN) {
> +		RTE_ETHDEV_LOG(ERR, "Ethernet device name is too
> long\n");
> +		return NULL;
> +	}
> 
>  	rte_eth_dev_shared_data_prepare();
> 
> --
> 2.17.1

Acked-by: Ali Alnubani <alialnu@mellanox.com>

  parent reply	other threads:[~2019-03-18 12:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 16:20 Stephen Hemminger
2019-03-14 16:20 ` Stephen Hemminger
2019-03-15  1:13 ` Zhang, Qi Z
2019-03-15  1:13   ` Zhang, Qi Z
2019-03-21 18:51   ` Ferruh Yigit
2019-03-21 18:51     ` Ferruh Yigit
2019-03-18 12:32 ` Ali Alnubani [this message]
2019-03-18 12:32   ` Ali Alnubani
2019-03-20 14:28 ` Ferruh Yigit
2019-03-20 14:28   ` Ferruh Yigit
2019-03-20 17:52   ` Stephen Hemminger
2019-03-20 17:52     ` Stephen Hemminger

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=VI1PR05MB42692398CE8A62DC2DFD2284D7470@VI1PR05MB4269.eurprd05.prod.outlook.com \
    --to=alialnu@mellanox.com \
    --cc=20190311181544.15646-1-stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /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).