All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [RFC PATCH v2] net: bridge: igmp: Extend IGMP query to be per vlan
Date: Wed, 13 Jan 2021 12:21:44 +0300	[thread overview]
Message-ID: <20210113092144.GG5105@kadam> (raw)
In-Reply-To: <20210112135903.3730765-1-horatiu.vultur@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 4616 bytes --]

Hi Horatiu,

url:    https://github.com/0day-ci/linux/commits/Horatiu-Vultur/net-bridge-igmp-Extend-IGMP-query-to-be-per-vlan/20210112-220655
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git  c73a45965dd54a10c368191804b9de661eee1007
config: i386-randconfig-m021-20210113 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/bridge/br_multicast.c:3866 br_multicast_set_querier() error: we previously assumed 'query' could be null (see line 3850)
net/bridge/br_multicast.c:3866 br_multicast_set_querier() warn: maybe use && instead of &

vim +/query +3866 net/bridge/br_multicast.c

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3833  int br_multicast_set_querier(struct net_bridge *br, unsigned long val, u16 vid)
c5c23260594c5701 Herbert Xu     2012-04-13  3834  {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3835  	struct bridge_mcast_other_query *other_query;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3836  	struct bridge_mcast_own_query *query;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3837  	struct net_bridge_vlan_group *vg;
b00589af3b047363 Linus Lüssing  2013-08-01  3838  	unsigned long max_delay;
b00589af3b047363 Linus Lüssing  2013-08-01  3839  
c5c23260594c5701 Herbert Xu     2012-04-13  3840  	val = !!val;
c5c23260594c5701 Herbert Xu     2012-04-13  3841  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3842  	if (vid == 0) {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3843  		vg = br_vlan_group(br);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3844  		if (vg)
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3845  			vid = vg->pvid;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3846  	}
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3847  
c5c23260594c5701 Herbert Xu     2012-04-13  3848  	spin_lock_bh(&br->multicast_lock);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3849  	query = br_mcast_find_own_query(&br->ip4_own_queries, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12 @3850  	if (!query) {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3851  		if (br_vlan_enabled(br->dev))
c5c23260594c5701 Herbert Xu     2012-04-13  3852  			goto unlock;
c5c23260594c5701 Herbert Xu     2012-04-13  3853  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3854  		br_mcast_add_queries(br, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3855  	}
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3856  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3857  	other_query = br_mcast_find_other_query(&br->ip4_other_queries, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3858  	if (!other_query)
b00589af3b047363 Linus Lüssing  2013-08-01  3859  		goto unlock;
b00589af3b047363 Linus Lüssing  2013-08-01  3860  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3861  	if (!val && query) {
                                                                    ^^^^^
"query" can be NULL.

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3862  		br_multicast_stop_querier(br, query, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3863  		goto unlock;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3864  	}
b00589af3b047363 Linus Lüssing  2013-08-01  3865  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12 @3866  	if (val & query->enabled)
                                                            ^^^^^^^^^^^^^^^^^^^^
Smatch suggests that this should be && because I guess "query->enabled"
is a boolean.  One of the difference between & and && is there are no
ordering requirements.

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3867  		goto unlock;
cc0fdd802859eaeb Linus Lüssing  2013-08-30  3868  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3869  	query->enabled = true;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3870  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3871  	max_delay = br->multicast_query_response_interval;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3872  	if (!timer_pending(&other_query->timer))
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3873  		other_query->delay_time = jiffies + max_delay;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3874  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3875  	br_multicast_start_querier(br, query, vid);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33916 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [kbuild] Re: [RFC PATCH v2] net: bridge: igmp: Extend IGMP query to be per vlan
Date: Wed, 13 Jan 2021 12:21:44 +0300	[thread overview]
Message-ID: <20210113092144.GG5105@kadam> (raw)
In-Reply-To: <20210112135903.3730765-1-horatiu.vultur@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 4616 bytes --]

Hi Horatiu,

url:    https://github.com/0day-ci/linux/commits/Horatiu-Vultur/net-bridge-igmp-Extend-IGMP-query-to-be-per-vlan/20210112-220655
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git  c73a45965dd54a10c368191804b9de661eee1007
config: i386-randconfig-m021-20210113 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/bridge/br_multicast.c:3866 br_multicast_set_querier() error: we previously assumed 'query' could be null (see line 3850)
net/bridge/br_multicast.c:3866 br_multicast_set_querier() warn: maybe use && instead of &

vim +/query +3866 net/bridge/br_multicast.c

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3833  int br_multicast_set_querier(struct net_bridge *br, unsigned long val, u16 vid)
c5c23260594c5701 Herbert Xu     2012-04-13  3834  {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3835  	struct bridge_mcast_other_query *other_query;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3836  	struct bridge_mcast_own_query *query;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3837  	struct net_bridge_vlan_group *vg;
b00589af3b047363 Linus Lüssing  2013-08-01  3838  	unsigned long max_delay;
b00589af3b047363 Linus Lüssing  2013-08-01  3839  
c5c23260594c5701 Herbert Xu     2012-04-13  3840  	val = !!val;
c5c23260594c5701 Herbert Xu     2012-04-13  3841  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3842  	if (vid == 0) {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3843  		vg = br_vlan_group(br);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3844  		if (vg)
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3845  			vid = vg->pvid;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3846  	}
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3847  
c5c23260594c5701 Herbert Xu     2012-04-13  3848  	spin_lock_bh(&br->multicast_lock);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3849  	query = br_mcast_find_own_query(&br->ip4_own_queries, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12 @3850  	if (!query) {
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3851  		if (br_vlan_enabled(br->dev))
c5c23260594c5701 Herbert Xu     2012-04-13  3852  			goto unlock;
c5c23260594c5701 Herbert Xu     2012-04-13  3853  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3854  		br_mcast_add_queries(br, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3855  	}
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3856  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3857  	other_query = br_mcast_find_other_query(&br->ip4_other_queries, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3858  	if (!other_query)
b00589af3b047363 Linus Lüssing  2013-08-01  3859  		goto unlock;
b00589af3b047363 Linus Lüssing  2013-08-01  3860  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3861  	if (!val && query) {
                                                                    ^^^^^
"query" can be NULL.

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3862  		br_multicast_stop_querier(br, query, vid);
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3863  		goto unlock;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3864  	}
b00589af3b047363 Linus Lüssing  2013-08-01  3865  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12 @3866  	if (val & query->enabled)
                                                            ^^^^^^^^^^^^^^^^^^^^
Smatch suggests that this should be && because I guess "query->enabled"
is a boolean.  One of the difference between & and && is there are no
ordering requirements.

8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3867  		goto unlock;
cc0fdd802859eaeb Linus Lüssing  2013-08-30  3868  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3869  	query->enabled = true;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3870  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3871  	max_delay = br->multicast_query_response_interval;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3872  	if (!timer_pending(&other_query->timer))
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3873  		other_query->delay_time = jiffies + max_delay;
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3874  
8d72e3d611eb9514 Horatiu Vultur 2021-01-12  3875  	br_multicast_start_querier(br, query, vid);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33916 bytes --]

  parent reply	other threads:[~2021-01-13  9:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 13:59 [RFC PATCH v2] net: bridge: igmp: Extend IGMP query to be per vlan Horatiu Vultur
2021-01-12 13:59 ` [Bridge] " Horatiu Vultur
2021-01-13  1:21 ` kernel test robot
2021-01-13  9:21 ` Dan Carpenter [this message]
2021-01-13  9:21   ` [kbuild] " Dan Carpenter
2021-01-13 12:15 ` Nikolay Aleksandrov
2021-01-13 12:15   ` [Bridge] " Nikolay Aleksandrov
2021-01-13 17:02   ` Horatiu Vultur
2021-01-13 17:02     ` [Bridge] " Horatiu Vultur
2021-01-16 15:39   ` Joachim Wiberg
2021-01-16 15:39     ` [Bridge] " Joachim Wiberg
2021-01-18 11:53     ` Nikolay Aleksandrov
2021-01-18 11:53       ` [Bridge] " Nikolay Aleksandrov
2021-01-22 16:05       ` Joachim Wiberg
2021-01-22 16:05         ` [Bridge] " Joachim Wiberg
2021-01-13  8:43 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210113092144.GG5105@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.