All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH 1/1] net: bridge: set error code on failure
@ 2016-12-03 11:33 ` Pan Bian
  0 siblings, 0 replies; 7+ messages in thread
From: Pan Bian @ 2016-12-03 11:33 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, bridge, netdev; +Cc: Pan Bian, linux-kernel

Function br_sysfs_addbr() does not set error code when the call
kobject_create_and_add() returns a NULL pointer. It may be better to
return "-ENOMEM" when kobject_create_and_add() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 net/bridge/br_sysfs_br.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index e120307..f88c4df 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -898,6 +898,7 @@ int br_sysfs_addbr(struct net_device *dev)
 	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
 			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
+		err = -ENOMEM;
 		goto out3;
 	}
 	return 0;
-- 
1.9.1



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

* [PATCH 1/1] net: bridge: set error code on failure
@ 2016-12-03 11:33 ` Pan Bian
  0 siblings, 0 replies; 7+ messages in thread
From: Pan Bian @ 2016-12-03 11:33 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, bridge, netdev; +Cc: linux-kernel, Pan Bian

Function br_sysfs_addbr() does not set error code when the call
kobject_create_and_add() returns a NULL pointer. It may be better to
return "-ENOMEM" when kobject_create_and_add() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 net/bridge/br_sysfs_br.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index e120307..f88c4df 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -898,6 +898,7 @@ int br_sysfs_addbr(struct net_device *dev)
 	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
 			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
+		err = -ENOMEM;
 		goto out3;
 	}
 	return 0;
-- 
1.9.1

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

* Re: [Bridge] [PATCH 1/1] net: bridge: set error code on failure
  2016-12-03 11:33 ` Pan Bian
@ 2016-12-05 16:37   ` Stephen Hemminger
  -1 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2016-12-05 16:37 UTC (permalink / raw)
  To: Pan Bian; +Cc: netdev, bridge, David S. Miller, linux-kernel

On Sat,  3 Dec 2016 19:33:23 +0800
Pan Bian <bianpan2016@163.com> wrote:

> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  net/bridge/br_sysfs_br.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index e120307..f88c4df 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -898,6 +898,7 @@ int br_sysfs_addbr(struct net_device *dev)
>  	if (!br->ifobj) {
>  		pr_info("%s: can't add kobject (directory) %s/%s\n",
>  			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
> +		err = -ENOMEM;
>  		goto out3;
>  	}
>  	return 0;

Makes sense. Although such a small allocation should never fail.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH 1/1] net: bridge: set error code on failure
@ 2016-12-05 16:37   ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2016-12-05 16:37 UTC (permalink / raw)
  To: Pan Bian; +Cc: David S. Miller, bridge, netdev, linux-kernel

On Sat,  3 Dec 2016 19:33:23 +0800
Pan Bian <bianpan2016@163.com> wrote:

> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  net/bridge/br_sysfs_br.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index e120307..f88c4df 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -898,6 +898,7 @@ int br_sysfs_addbr(struct net_device *dev)
>  	if (!br->ifobj) {
>  		pr_info("%s: can't add kobject (directory) %s/%s\n",
>  			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
> +		err = -ENOMEM;
>  		goto out3;
>  	}
>  	return 0;

Makes sense. Although such a small allocation should never fail.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [Bridge] [PATCH 1/1] net: bridge: set error code on failure
  2016-12-03 11:33 ` Pan Bian
  (?)
@ 2016-12-05 18:27   ` David Miller
  -1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-12-05 18:27 UTC (permalink / raw)
  To: bianpan2016; +Cc: netdev, bridge, linux-kernel

From: Pan Bian <bianpan2016@163.com>
Date: Sat,  3 Dec 2016 19:33:23 +0800

> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied.

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

* Re: [PATCH 1/1] net: bridge: set error code on failure
@ 2016-12-05 18:27   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-12-05 18:27 UTC (permalink / raw)
  To: bianpan2016; +Cc: stephen, bridge, netdev, linux-kernel

From: Pan Bian <bianpan2016@163.com>
Date: Sat,  3 Dec 2016 19:33:23 +0800

> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied.

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

* Re: [PATCH 1/1] net: bridge: set error code on failure
@ 2016-12-05 18:27   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-12-05 18:27 UTC (permalink / raw)
  To: bianpan2016; +Cc: netdev, bridge, linux-kernel

From: Pan Bian <bianpan2016@163.com>
Date: Sat,  3 Dec 2016 19:33:23 +0800

> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied.

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

end of thread, other threads:[~2016-12-05 18:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-03 11:33 [Bridge] [PATCH 1/1] net: bridge: set error code on failure Pan Bian
2016-12-03 11:33 ` Pan Bian
2016-12-05 16:37 ` [Bridge] " Stephen Hemminger
2016-12-05 16:37   ` Stephen Hemminger
2016-12-05 18:27 ` [Bridge] " David Miller
2016-12-05 18:27   ` David Miller
2016-12-05 18:27   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.