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

* Re: [PATCH] net: A little dev_valid_name() improvement
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2009-01-18 20:28 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev

Matvejchikov Ilya wrote:
> This patch removes redundant complexity when checking the
> network device name to be valid.

And also disallows any name starting with a dot, while
previously it was allowed/valid.

I don't think this patch is good.

/mjt

> -	if (*name == '\0')
> +	if (*name == '\0' || *name == '.')
>  		return 0;
> -	if (!strcmp(name, ".") || !strcmp(name, ".."))
> -		return 0;


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

* Re: [PATCH] net: A little dev_valid_name() improvement
  2009-01-18 20:28 ` Michael Tokarev
@ 2009-01-19  2:17   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-01-19  2:17 UTC (permalink / raw)
  To: mjt; +Cc: matvejchikov, netdev

From: Michael Tokarev <mjt@tls.msk.ru>
Date: Sun, 18 Jan 2009 23:28:46 +0300

> Matvejchikov Ilya wrote:
> > This patch removes redundant complexity when checking the
> > network device name to be valid.
> 
> And also disallows any name starting with a dot, while
> previously it was allowed/valid.
> 
> I don't think this patch is good.

Agreed, I'm not applying this.

^ permalink raw reply	[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).