net: core: drop pointless check in __dev_alloc_name
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Sun, 12 Nov 2017 23:15:07 +0000 (00:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 07:38:46 +0000 (16:38 +0900)
The only caller passes a stack buffer as buf, so it won't equal the
passed-in name. Moreover, we're already using buf as a scratch buffer
inside the if (p) {} block, so if buf and name were the same, that
snprintf() call would be overwriting its own format string.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index 7580c2046c951d27912e06cc29e75e2d6aff5b8a..4cedc7595f1f890231f4867db4ad1a7e5d346fe0 100644 (file)
@@ -1095,8 +1095,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
                free_page((unsigned long) inuse);
        }
 
-       if (buf != name)
-               snprintf(buf, IFNAMSIZ, name, i);
+       snprintf(buf, IFNAMSIZ, name, i);
        if (!__dev_get_by_name(net, buf))
                return i;