From: Rasmus Villemoes Date: Sun, 12 Nov 2017 23:15:07 +0000 (+0100) Subject: net: core: drop pointless check in __dev_alloc_name X-Git-Tag: v4.15-rc1~108^2~33^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6224abda0db8845756571833744d4414f144ecb5;p=thirdparty%2Flinux.git net: core: drop pointless check in __dev_alloc_name 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 Signed-off-by: David S. Miller --- diff --git a/net/core/dev.c b/net/core/dev.c index 7580c2046c951..4cedc7595f1f8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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;