diff mbox series

[6/7] net: core: maybe return -EEXIST in __dev_alloc_name

Message ID 20171112231511.4666-7-linux@rasmusvillemoes.dk
State Accepted, archived
Delegated to: David Miller
Headers show
Series net: core: devname allocation cleanups | expand

Commit Message

Rasmus Villemoes Nov. 12, 2017, 11:15 p.m. UTC
If we're given format string with no %d, -EEXIST is a saner error code.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Hemminger Nov. 13, 2017, 12:03 a.m. UTC | #1
On Mon, 13 Nov 2017 00:15:09 +0100
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> If we're given format string with no %d, -EEXIST is a saner error code.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  net/core/dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index c0a92cf27566..7c08b4ca7b76 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1104,7 +1104,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
>  	 * when the name is long and there isn't enough space left
>  	 * for the digits, or if all bits are used.
>  	 */
> -	return -ENFILE;
> +	return p ? -ENFILE : -EEXIST;
>  }
>  
>  static int dev_alloc_name_ns(struct net *net,

This is potentially a change to user ABI with no real advantage.
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index c0a92cf27566..7c08b4ca7b76 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1104,7 +1104,7 @@  static int __dev_alloc_name(struct net *net, const char *name, char *buf)
 	 * when the name is long and there isn't enough space left
 	 * for the digits, or if all bits are used.
 	 */
-	return -ENFILE;
+	return p ? -ENFILE : -EEXIST;
 }
 
 static int dev_alloc_name_ns(struct net *net,