netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matvejchikov Ilya" <matvejchikov@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH] net: A little dev_valid_name() improvement
Date: Sun, 18 Jan 2009 22:07:56 +0300	[thread overview]
Message-ID: <8496f91a0901181107o17ee80e7h7fab67194a7bde23@mail.gmail.com> (raw)

This patch removes redundant complexity when checking the
network device name to be valid.

Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
 net/core/dev.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8d67597..9c5d8f4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -760,12 +760,10 @@ struct net_device * dev_get_by_flags(struct net
*net, unsigned short if_flags, u
  */
 int dev_valid_name(const char *name)
 {
-	if (*name == '\0')
+	if (*name == '\0' || *name == '.')
 		return 0;
 	if (strlen(name) >= IFNAMSIZ)
 		return 0;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
-		return 0;

 	while (*name) {
 		if (*name == '/' || isspace(*name))
-- 
1.6.1

             reply	other threads:[~2009-01-18 19:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 19:07 Matvejchikov Ilya [this message]
2009-01-18 20:28 ` [PATCH] net: A little dev_valid_name() improvement Michael Tokarev
2009-01-19  2:17   ` David Miller

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=8496f91a0901181107o17ee80e7h7fab67194a7bde23@mail.gmail.com \
    --to=matvejchikov@gmail.com \
    --cc=netdev@vger.kernel.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).