Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535381 > unrolled thread

[PATCH 1/1] net: bridge: set error code on failure

Started byPan Bian <bianpan2016@163.com>
First post2016-12-03 12:40 +0100
Last post2016-12-05 19:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] net: bridge: set error code on failure Pan Bian <bianpan2016@163.com> - 2016-12-03 12:40 +0100
    Re: [PATCH 1/1] net: bridge: set error code on failure Stephen Hemminger <stephen@networkplumber.org> - 2016-12-05 17:40 +0100
    Re: [PATCH 1/1] net: bridge: set error code on failure David Miller <davem@davemloft.net> - 2016-12-05 19:30 +0100

#1535381 — [PATCH 1/1] net: bridge: set error code on failure

FromPan Bian <bianpan2016@163.com>
Date2016-12-03 12:40 +0100
Subject[PATCH 1/1] net: bridge: set error code on failure
Message-ID<sKgPD-wb-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1536225

FromStephen Hemminger <stephen@networkplumber.org>
Date2016-12-05 17:40 +0100
Message-ID<sL4t4-6UN-9@gated-at.bofh.it>
In reply to#1535381
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>

[toc] | [prev] | [next] | [standalone]


#1536305

FromDavid Miller <davem@davemloft.net>
Date2016-12-05 19:30 +0100
Message-ID<sL6bv-84q-23@gated-at.bofh.it>
In reply to#1535381
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web