DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Qi Z" <qi.z.zhang@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ethdev: check for invalid device name
Date: Thu, 14 Mar 2019 01:01:45 +0000	[thread overview]
Message-ID: <039ED4275CED7440929022BC67E706115334C632@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20190313103232.35804089@shemminger-XPS-13-9360>



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, March 14, 2019 1:33 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] ethdev: check for invalid device name
> 
> On Wed, 13 Mar 2019 12:52:50 +0000
> "Zhang, Qi Z" <qi.z.zhang@intel.com> wrote:
> 
> > HI
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> > > Hemminger
> > > Sent: Tuesday, March 12, 2019 2:16 AM
> > > To: dev@dpdk.org
> > > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > > Subject: [dpdk-dev] [PATCH] 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>
> > > ---
> > > v1 - previously sent as RFC
> > >
> > >  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 85c1794968dd..0b81980ff71c
> > > 100644
> > > --- a/lib/librte_ethdev/rte_ethdev.c
> > > +++ b/lib/librte_ethdev/rte_ethdev.c
> > > @@ -439,6 +439,16 @@ rte_eth_dev_allocate(const char *name)
> > >  	uint16_t port_id;
> > >  	struct rte_eth_dev *eth_dev = NULL;
> > >
> > > +	if (*name) {
> >
> > Is above check same as "strlen(name) == 0"?
> 
> Yes, but checking for first null byte is slightly quicker. Alternative would be to call
> strnlen() once.

But you are checking the not null byte here right? should it be if (!(*name))?
	

  reply	other threads:[~2019-03-14  1:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11 18:15 Stephen Hemminger
2019-03-13 12:52 ` Zhang, Qi Z
2019-03-13 17:32   ` Stephen Hemminger
2019-03-14  1:01     ` Zhang, Qi Z [this message]
2019-03-14  1:01       ` Zhang, Qi Z
2019-03-14  7:23 ` Ali Alnubani
2019-03-14  7:23   ` Ali Alnubani

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=039ED4275CED7440929022BC67E706115334C632@SHSMSX103.ccr.corp.intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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).