[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 31 Dec 2014 14:17:40 +0100
From: Sedat Dilek <sedat.dilek@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Johannes Berg <johannes.berg@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Wu Fengguang <fengguang.wu@...el.com>
Subject: Re: net.git: Call-trace after "Merge branch 'netlink_multicast'"
On Mon, Dec 29, 2014 at 10:33 PM, David Miller <davem@...emloft.net> wrote:
> 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>
Thanks Dave for pushing this!
Guten Rutsch (Happy new year),
- Sedat -
> ---
> 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