netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: A little dev_valid_name() improvement
@ 2009-01-18 19:07 Matvejchikov Ilya
  2009-01-18 20:28 ` Michael Tokarev
  0 siblings, 1 reply; 3+ messages in thread
From: Matvejchikov Ilya @ 2009-01-18 19:07 UTC (permalink / raw)
  To: netdev

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-19  2:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18 19:07 [PATCH] net: A little dev_valid_name() improvement Matvejchikov Ilya
2009-01-18 20:28 ` Michael Tokarev
2009-01-19  2:17   ` David Miller

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).