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


Groups > linux.kernel > #1370311 > unrolled thread

[PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr

Started byBastien Philbert <bastienphilbert@gmail.com>
First post2016-04-04 01:10 +0200
Last post2016-04-04 22:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr Bastien Philbert <bastienphilbert@gmail.com> - 2016-04-04 01:10 +0200
    Re: [PATCH] bridge:Fix incorrect variable assignment on error path in  br_sysfs_addbr Bastien Philbert <bastienphilbert@gmail.com> - 2016-04-04 22:20 +0200
    Re: [PATCH] bridge:Fix incorrect variable assignment on error path  in br_sysfs_addbr David Miller <davem@davemloft.net> - 2016-04-04 22:20 +0200

#1370311 — [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr

FromBastien Philbert <bastienphilbert@gmail.com>
Date2016-04-04 01:10 +0200
Subject[PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
Message-ID<rjZjz-2aV-5@gated-at.bofh.it>
This fixes the incorrect variable assignment on error path in
br_sysfs_addbr for when the call to kobject_create_and_add
fails to assign the value of -EINVAL to the returned variable of
err rather then incorrectly return zero making callers think this
function has succeededed due to the previous assignment being
assigned zero when assigning it the successful return value of
the call to sysfs_create_group which is zero.

Signed-off-by: Bastien Philbert <bastienphilbert@gmail.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 6b80914..f4d40ed 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -870,6 +870,7 @@ int br_sysfs_addbr(struct net_device *dev)
 
 	br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
 	if (!br->ifobj) {
+		err = -EINVAL;
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
 			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
 		goto out3;
-- 
2.5.0

[toc] | [next] | [standalone]


#1370851 — Re: [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr

FromBastien Philbert <bastienphilbert@gmail.com>
Date2016-04-04 22:20 +0200
SubjectRe: [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
Message-ID<rkj8B-97-1@gated-at.bofh.it>
In reply to#1370311

On 2016-04-04 04:14 PM, David Miller wrote:
> From: Bastien Philbert <bastienphilbert@gmail.com>
> Date: Sun,  3 Apr 2016 19:04:26 -0400
> 
>> This fixes the incorrect variable assignment on error path in
>> br_sysfs_addbr for when the call to kobject_create_and_add
>> fails to assign the value of -EINVAL to the returned variable of
>> err rather then incorrectly return zero making callers think this
>> function has succeededed due to the previous assignment being
>> assigned zero when assigning it the successful return value of
>> the call to sysfs_create_group which is zero.
>>
>> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
> 
> Applied, but please put a space after the subsystem prefix and the
> colon character in your subject lines in the future.
> 
> Doesn't that really look odd to you, the way you did it? "net:Fix"?
> 
> Doesn't it look more natural, and consistent with what all other
> patch submitters do, if it's "net: Fix"?
> 
> Thanks.
> 
Done, sorry about that :(. Will remember for future patches.
Bastien

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


#1370855 — Re: [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr

FromDavid Miller <davem@davemloft.net>
Date2016-04-04 22:20 +0200
SubjectRe: [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
Message-ID<rkj8B-97-3@gated-at.bofh.it>
In reply to#1370311
From: Bastien Philbert <bastienphilbert@gmail.com>
Date: Sun,  3 Apr 2016 19:04:26 -0400

> This fixes the incorrect variable assignment on error path in
> br_sysfs_addbr for when the call to kobject_create_and_add
> fails to assign the value of -EINVAL to the returned variable of
> err rather then incorrectly return zero making callers think this
> function has succeededed due to the previous assignment being
> assigned zero when assigning it the successful return value of
> the call to sysfs_create_group which is zero.
> 
> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>

Applied, but please put a space after the subsystem prefix and the
colon character in your subject lines in the future.

Doesn't that really look odd to you, the way you did it? "net:Fix"?

Doesn't it look more natural, and consistent with what all other
patch submitters do, if it's "net: Fix"?

Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web