[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20141229.163311.498586171360350188.davem@davemloft.net>
Date: Mon, 29 Dec 2014 16:33:11 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: sedat.dilek@...il.com
Cc: johannes.berg@...el.com, netdev@...r.kernel.org,
fengguang.wu@...el.com
Subject: Re: net.git: Call-trace after "Merge branch 'netlink_multicast'"
From: Sedat Dilek <sedat.dilek@...il.com>
Date: Sun, 28 Dec 2014 10:34:51 +0100
> On Sun, Dec 28, 2014 at 8:54 AM, Sedat Dilek <sedat.dilek@...il.com> wrote:
>> Just a small thing, if you look at this...
>>
>> With gcc-4.9.2 I see this warning in my logs...
>>
>> net/netlink/genetlink.c: In function 'genl_bind':
>> net/netlink/genetlink.c:1018:2: warning: 'err' may be used
>> uninitialized in this function [-Wmaybe-uninitialized]
>>
>
> Attached patch fixes the issue for me.
Ok since the user can request arbitrary multicast groups, we cannot
warn in this situation.
And since initializing 'err' to zero makes the whole 'found'
variable completely unnecessary, we can delete that too.
This is the final patch I am applying, thanks for all of your
help.
====================
[PATCH] genetlink: A genl_bind() to an out-of-range multicast group should not WARN().
Users can request to bind to arbitrary multicast groups, so warning
when the requested group number is out of range is not appropriate.
And with the warning removed, and the 'err' variable properly given
an initial value, we can remove 'found' altogether.
Reported-by: Sedat Dilek <sedat.dilek@...il.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
---
net/netlink/genetlink.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 91566ed..2e11061 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {
static int genl_bind(struct net *net, int group)
{
- int i, err;
- bool found = false;
+ int i, err = 0;
down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
@@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group)
err = f->mcast_bind(net, fam_grp);
else
err = 0;
- found = true;
break;
}
}
}
up_read(&cb_lock);
- if (WARN_ON(!found))
- err = 0;
-
return err;
}
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists