All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-05-01  8:02 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-01  8:02 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Hangbin Liu <liuhangbin@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   57ae8a492116910bad2b3497ffe555b3a4b4180f
commit: 1fcd5d448c59ca2703504806eb8131ce8e411a70 Bonding: split bond_handle_vlan from bond_arp_send
date:   10 weeks ago
:::::: branch date: 15 hours ago
:::::: commit date: 10 weeks ago
config: riscv-randconfig-c006-20220427 (https://download.01.org/0day-ci/archive/20220501/202205011521.Q9a3oxjA-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1fcd5d448c59ca2703504806eb8131ce8e411a70
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 1fcd5d448c59ca2703504806eb8131ce8e411a70
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                           status = 0;
                           ^        ~
   drivers/i2c/busses/i2c-npcm7xx.c:1709:4: note: Value stored to 'status' is never read
                           status = 0;
                           ^        ~
   drivers/i2c/busses/i2c-npcm7xx.c:1719:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores]
                   status = readx_poll_timeout(npcm_i2c_get_SCL, _adap, val, !val,
                   ^
   drivers/i2c/busses/i2c-npcm7xx.c:1719:3: note: Value stored to 'status' is never read
   drivers/i2c/busses/i2c-npcm7xx.c:2160:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = bus->cmd_err;
           ^     ~~~~~~~~~~~~
   drivers/i2c/busses/i2c-npcm7xx.c:2160:2: note: Value stored to 'ret' is never read
           ret = bus->cmd_err;
           ^     ~~~~~~~~~~~~
   drivers/i2c/busses/i2c-npcm7xx.c:2164:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = i2c_recover_bus(adap);
                   ^     ~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/busses/i2c-npcm7xx.c:2164:3: note: Value stored to 'ret' is never read
                   ret = i2c_recover_bus(adap);
                   ^     ~~~~~~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   drivers/tty/serial/fsl_lpuart.c:1283:33: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
           sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
                                          ^
   drivers/tty/serial/fsl_lpuart.c:2868:6: note: Assuming field 'suspended' is 0
           if (sport->port.suspended && !irq_wake)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:2868:28: note: Left side of '&&' is false
           if (sport->port.suspended && !irq_wake)
                                     ^
   drivers/tty/serial/fsl_lpuart.c:2871:2: note: Taking false branch
           if (lpuart_is_32(sport))
           ^
   drivers/tty/serial/fsl_lpuart.c:2876:6: note: Assuming field 'lpuart_dma_rx_use' is true
           if (sport->lpuart_dma_rx_use) {
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:2876:2: note: Taking true branch
           if (sport->lpuart_dma_rx_use) {
           ^
   drivers/tty/serial/fsl_lpuart.c:2877:7: note: Assuming 'irq_wake' is true
                   if (irq_wake) {
                       ^~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:2877:3: note: Taking true branch
                   if (irq_wake) {
                   ^
   drivers/tty/serial/fsl_lpuart.c:2878:9: note: Calling 'lpuart_start_rx_dma'
                           if (!lpuart_start_rx_dma(sport))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1274:9: note: Assuming the condition is false
           bits = (termios->c_cflag & CSIZE) == CS7 ? 9 : 10;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1274:9: note: '?' condition is false
   drivers/tty/serial/fsl_lpuart.c:1275:6: note: Assuming the condition is false
           if (termios->c_cflag & PARENB)
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1275:2: note: Taking false branch
           if (termios->c_cflag & PARENB)
           ^
   drivers/tty/serial/fsl_lpuart.c:1283:33: note: The result of the left shift is undefined because the right operand is negative
           sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
                                          ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   drivers/net/bonding/bond_main.c:1698:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:1698:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:2799:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2799:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
>> drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2800:21: note: Value stored to 'slave_dev' during its initialization is never read
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   drivers/net/bonding/bond_3ad.c:671:14: warning: Access to field 'lag_ports' results in a dereference of a null pointer (loaded from variable 'aggregator') [clang-analyzer-core.NullDereference]
           for (port = aggregator->lag_ports; port;
                       ^
   drivers/net/bonding/bond_3ad.c:2335:6: note: Assuming the condition is false
           if (!bond_has_slaves(bond))
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2335:2: note: Taking false branch
           if (!bond_has_slaves(bond))
           ^
   drivers/net/bonding/bond_3ad.c:2338:2: note: Taking false branch
           if (bond_agg_timer_advance(bond)) {
           ^
   drivers/net/bonding/bond_3ad.c:2357:2: note: Loop condition is true.  Entering loop body
           bond_for_each_slave_rcu(bond, slave, iter) {
           ^
   include/net/bonding.h:87:2: note: expanded from macro 'bond_for_each_slave_rcu'
           netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
           ^
   include/linux/netdevice.h:4576:2: note: expanded from macro 'netdev_for_each_lower_private_rcu'
           for (iter = &(dev)->adj_list.lower, \
           ^
   drivers/net/bonding/bond_3ad.c:2359:7: note: Assuming field 'slave' is non-null
                   if (!port->slave) {
                       ^~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2359:3: note: Taking false branch
                   if (!port->slave) {
                   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Calling 'ad_rx_machine'
                   ad_rx_machine(NULL, port);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1098:6: note: 'lacpdu' is null
           if (lacpdu) {
               ^~~~~~
   drivers/net/bonding/bond_3ad.c:1098:2: note: Taking false branch
           if (lacpdu) {
           ^
   drivers/net/bonding/bond_3ad.c:1105:6: note: Assuming the condition is false
           if (port->sm_vars & AD_PORT_BEGIN) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1105:2: note: Taking false branch
           if (port->sm_vars & AD_PORT_BEGIN) {
           ^
   drivers/net/bonding/bond_3ad.c:1109:13: note: Left side of '&&' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                      ^
   drivers/net/bonding/bond_3ad.c:1109:49: note: Assuming field 'is_enabled' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                                                          ^~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1109:9: note: Taking false branch
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                  ^
   drivers/net/bonding/bond_3ad.c:1112:11: note: 'lacpdu' is null
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                    ^~~~~~
   drivers/net/bonding/bond_3ad.c:1112:18: note: Left side of '&&' is false
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                           ^
   drivers/net/bonding/bond_3ad.c:1121:7: note: Assuming field 'sm_rx_timer_counter' is 0
                   if (port->sm_rx_timer_counter &&
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1121:33: note: Left side of '&&' is false
                   if (port->sm_rx_timer_counter &&
                                                 ^
   drivers/net/bonding/bond_3ad.c:1135:4: note: Control jumps to the 'default' case at line 1145
                           switch (port->sm_rx_state) {
                           ^
   drivers/net/bonding/bond_3ad.c:1146:5: note:  Execution continues on line 1153
                                   break;
                                   ^
   drivers/net/bonding/bond_3ad.c:1153:28: note: 'last_state' is equal to field 'sm_rx_state'
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                     ^~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1153:6: note: Left side of '||' is false
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
               ^
   drivers/net/bonding/bond_3ad.c:1153:44: note: 'lacpdu' is null
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                                     ^~~~~~
   drivers/net/bonding/bond_3ad.c:1153:2: note: Taking false branch
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
           ^
   drivers/net/bonding/bond_3ad.c:1220:1: note: Returning without writing to 'port->aggregator'
   }
   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Returning from 'ad_rx_machine'
                   ad_rx_machine(NULL, port);

vim +/slave_dev +2800 drivers/net/bonding/bond_main.c

f5b2b966f032f2 Jay Vosburgh     2006-09-22  2795  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2796  static bool bond_handle_vlan(struct slave *slave, struct bond_vlan_tag *tags,
1fcd5d448c59ca Hangbin Liu      2022-02-21  2797  			     struct sk_buff *skb)
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2798  {
e2a7420df2e013 Jarod Wilson     2019-06-07  2799  	struct net_device *bond_dev = slave->bond->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21 @2800  	struct net_device *slave_dev = slave->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2801  	struct bond_vlan_tag *outer_tag = tags;
44a4085538c844 Vlad Yasevich    2014-05-16  2802  
3e403a77779faf Veaceslav Falico 2014-07-17  2803  	if (!tags || tags->vlan_proto == VLAN_N_VID)
1fcd5d448c59ca Hangbin Liu      2022-02-21  2804  		return true;
3e403a77779faf Veaceslav Falico 2014-07-17  2805  
3e403a77779faf Veaceslav Falico 2014-07-17  2806  	tags++;
3e403a77779faf Veaceslav Falico 2014-07-17  2807  
44a4085538c844 Vlad Yasevich    2014-05-16  2808  	/* Go through all the tags backwards and add them to the packet */
3e403a77779faf Veaceslav Falico 2014-07-17  2809  	while (tags->vlan_proto != VLAN_N_VID) {
3e403a77779faf Veaceslav Falico 2014-07-17  2810  		if (!tags->vlan_id) {
3e403a77779faf Veaceslav Falico 2014-07-17  2811  			tags++;
44a4085538c844 Vlad Yasevich    2014-05-16  2812  			continue;
3e403a77779faf Veaceslav Falico 2014-07-17  2813  		}
44a4085538c844 Vlad Yasevich    2014-05-16  2814  
e2a7420df2e013 Jarod Wilson     2019-06-07  2815  		slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2816  			  ntohs(outer_tag->vlan_proto), tags->vlan_id);
62749e2cb3c4a7 Jiri Pirko       2014-11-19  2817  		skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2818  						tags->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2819  		if (!skb) {
4873ac3c8ed3b0 dingtianhong     2014-03-25  2820  			net_err_ratelimited("failed to insert inner VLAN tag\n");
1fcd5d448c59ca Hangbin Liu      2022-02-21  2821  			return false;
fbd929f2dce460 dingtianhong     2014-03-25  2822  		}
3e403a77779faf Veaceslav Falico 2014-07-17  2823  
3e403a77779faf Veaceslav Falico 2014-07-17  2824  		tags++;
fbd929f2dce460 dingtianhong     2014-03-25  2825  	}
44a4085538c844 Vlad Yasevich    2014-05-16  2826  	/* Set the outer tag */
3e403a77779faf Veaceslav Falico 2014-07-17  2827  	if (outer_tag->vlan_id) {
e2a7420df2e013 Jarod Wilson     2019-06-07  2828  		slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2829  			  ntohs(outer_tag->vlan_proto), outer_tag->vlan_id);
b4bef1b57544b1 Jiri Pirko       2014-11-19  2830  		__vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2831  				       outer_tag->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2832  	}
3e403a77779faf Veaceslav Falico 2014-07-17  2833  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2834  	return true;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2835  }
1fcd5d448c59ca Hangbin Liu      2022-02-21  2836  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-06-21 16:41 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-06-21 16:41 UTC (permalink / raw)
  To: kbuild

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

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Hangbin Liu <liuhangbin@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   78ca55889a549a9a194c6ec666836329b774ab6d
commit: 1fcd5d448c59ca2703504806eb8131ce8e411a70 Bonding: split bond_handle_vlan from bond_arp_send
date:   4 months ago
:::::: branch date: 26 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c002-20220617 (https://download.01.org/0day-ci/archive/20220622/202206220016.ZPjyiSyW-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d764aa7fc6b9cc3fbe960019018f5f9e941eb0a6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1fcd5d448c59ca2703504806eb8131ce8e411a70
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 1fcd5d448c59ca2703504806eb8131ce8e411a70
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                           ret = 0;
                           ^     ~
   fs/btrfs/extent-tree.c:5366:4: note: Value stored to 'ret' is never read
                           ret = 0;
                           ^     ~
   fs/btrfs/extent-tree.c:6003:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   fs/btrfs/extent-tree.c:6003:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   1 warning generated.
   block/blk-mq-cpumap.c:21:33: warning: Division by zero [clang-analyzer-core.DivideZero]
           return qmap->queue_offset + (q % nr_queues);
                                          ^
   block/blk-mq-cpumap.c:38:2: note: 'nr_queues' initialized here
           unsigned int nr_queues = qmap->nr_queues;
           ^~~~~~~~~~~~~~~~~~~~~~
   block/blk-mq-cpumap.c:41:2: note: Loop condition is true.  Entering loop body
           for_each_possible_cpu(cpu)
           ^
   include/linux/cpumask.h:814:36: note: expanded from macro 'for_each_possible_cpu'
   #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
                                      ^
   include/linux/cpumask.h:190:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   block/blk-mq-cpumap.c:41:2: note: Loop condition is false. Execution continues on line 48
           for_each_possible_cpu(cpu)
           ^
   include/linux/cpumask.h:814:36: note: expanded from macro 'for_each_possible_cpu'
   #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
                                      ^
   include/linux/cpumask.h:190:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   block/blk-mq-cpumap.c:48:2: note: Loop condition is true.  Entering loop body
           for_each_present_cpu(cpu) {
           ^
   include/linux/cpumask.h:816:36: note: expanded from macro 'for_each_present_cpu'
   #define for_each_present_cpu(cpu)  for_each_cpu((cpu), cpu_present_mask)
                                      ^
   include/linux/cpumask.h:190:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   block/blk-mq-cpumap.c:49:7: note: Assuming 'q' is >= 'nr_queues'
                   if (q >= nr_queues)
                       ^~~~~~~~~~~~~~
   block/blk-mq-cpumap.c:49:3: note: Taking true branch
                   if (q >= nr_queues)
                   ^
   block/blk-mq-cpumap.c:50:4: note:  Execution continues on line 54
                           break;
                           ^
   block/blk-mq-cpumap.c:54:2: note: Loop condition is true.  Entering loop body
           for_each_possible_cpu(cpu) {
           ^
   include/linux/cpumask.h:814:36: note: expanded from macro 'for_each_possible_cpu'
   #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
                                      ^
   include/linux/cpumask.h:190:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   block/blk-mq-cpumap.c:55:3: note: Taking false branch
                   if (map[cpu] != -1)
                   ^
   block/blk-mq-cpumap.c:63:7: note: 'q' is >= 'nr_queues'
                   if (q < nr_queues) {
                       ^
   block/blk-mq-cpumap.c:63:3: note: Taking false branch
                   if (q < nr_queues) {
                   ^
   block/blk-mq-cpumap.c:67:8: note: 'first_sibling' is equal to 'cpu'
                           if (first_sibling == cpu)
                               ^~~~~~~~~~~~~
   block/blk-mq-cpumap.c:67:4: note: Taking true branch
                           if (first_sibling == cpu)
                           ^
   block/blk-mq-cpumap.c:68:34: note: Passing the value 0 via 2nd parameter 'nr_queues'
                                   map[cpu] = queue_index(qmap, nr_queues, q++);
                                                                ^~~~~~~~~
   block/blk-mq-cpumap.c:68:16: note: Calling 'queue_index'
                                   map[cpu] = queue_index(qmap, nr_queues, q++);
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   block/blk-mq-cpumap.c:21:33: note: Division by zero
           return qmap->queue_offset + (q % nr_queues);
                                        ~~^~~~~~~~~~~
   5 warnings generated.
   drivers/net/bonding/bond_main.c:1698:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:1698:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:2799:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2799:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
>> drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2800:21: note: Value stored to 'slave_dev' during its initialization is never read
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   drivers/net/bonding/bond_3ad.c:671:14: warning: Access to field 'lag_ports' results in a dereference of a null pointer (loaded from variable 'aggregator') [clang-analyzer-core.NullDereference]
           for (port = aggregator->lag_ports; port;
                       ^
   drivers/net/bonding/bond_3ad.c:2335:6: note: Assuming the condition is false
           if (!bond_has_slaves(bond))
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2335:2: note: Taking false branch
           if (!bond_has_slaves(bond))
           ^
   drivers/net/bonding/bond_3ad.c:2338:2: note: Taking false branch
           if (bond_agg_timer_advance(bond)) {
           ^
   drivers/net/bonding/bond_3ad.c:2357:2: note: Loop condition is true.  Entering loop body
           bond_for_each_slave_rcu(bond, slave, iter) {
           ^
   include/net/bonding.h:87:2: note: expanded from macro 'bond_for_each_slave_rcu'
           netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
           ^
   include/linux/netdevice.h:4576:2: note: expanded from macro 'netdev_for_each_lower_private_rcu'
           for (iter = &(dev)->adj_list.lower, \
           ^
   drivers/net/bonding/bond_3ad.c:2359:7: note: Assuming field 'slave' is non-null
                   if (!port->slave) {
                       ^~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2359:3: note: Taking false branch
                   if (!port->slave) {
                   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Calling 'ad_rx_machine'
                   ad_rx_machine(NULL, port);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1098:6: note: 'lacpdu' is null
           if (lacpdu) {
               ^~~~~~
   drivers/net/bonding/bond_3ad.c:1098:2: note: Taking false branch
           if (lacpdu) {
           ^
   drivers/net/bonding/bond_3ad.c:1105:6: note: Assuming the condition is false
           if (port->sm_vars & AD_PORT_BEGIN) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1105:2: note: Taking false branch
           if (port->sm_vars & AD_PORT_BEGIN) {
           ^
   drivers/net/bonding/bond_3ad.c:1109:13: note: Left side of '&&' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                      ^
   drivers/net/bonding/bond_3ad.c:1109:49: note: Assuming field 'is_enabled' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                                                          ^~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1109:9: note: Taking false branch
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                  ^
   drivers/net/bonding/bond_3ad.c:1112:11: note: 'lacpdu' is null
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                    ^~~~~~
   drivers/net/bonding/bond_3ad.c:1112:18: note: Left side of '&&' is false
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                           ^
   drivers/net/bonding/bond_3ad.c:1121:7: note: Assuming field 'sm_rx_timer_counter' is 0
                   if (port->sm_rx_timer_counter &&
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1121:33: note: Left side of '&&' is false
                   if (port->sm_rx_timer_counter &&
                                                 ^
   drivers/net/bonding/bond_3ad.c:1135:4: note: Control jumps to the 'default' case at line 1145
                           switch (port->sm_rx_state) {
                           ^
   drivers/net/bonding/bond_3ad.c:1146:5: note:  Execution continues on line 1153
                                   break;
                                   ^
   drivers/net/bonding/bond_3ad.c:1153:28: note: 'last_state' is equal to field 'sm_rx_state'
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                     ^~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1153:6: note: Left side of '||' is false
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
               ^
   drivers/net/bonding/bond_3ad.c:1153:44: note: 'lacpdu' is null
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                                     ^~~~~~
   drivers/net/bonding/bond_3ad.c:1153:2: note: Taking false branch
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
           ^
   drivers/net/bonding/bond_3ad.c:1220:1: note: Returning without writing to 'port->aggregator'
   }
   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Returning from 'ad_rx_machine'
                   ad_rx_machine(NULL, port);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/slave_dev +2800 drivers/net/bonding/bond_main.c

f5b2b966f032f2 Jay Vosburgh     2006-09-22  2795  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2796  static bool bond_handle_vlan(struct slave *slave, struct bond_vlan_tag *tags,
1fcd5d448c59ca Hangbin Liu      2022-02-21  2797  			     struct sk_buff *skb)
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2798  {
e2a7420df2e013 Jarod Wilson     2019-06-07  2799  	struct net_device *bond_dev = slave->bond->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21 @2800  	struct net_device *slave_dev = slave->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2801  	struct bond_vlan_tag *outer_tag = tags;
44a4085538c844 Vlad Yasevich    2014-05-16  2802  
3e403a77779faf Veaceslav Falico 2014-07-17  2803  	if (!tags || tags->vlan_proto == VLAN_N_VID)
1fcd5d448c59ca Hangbin Liu      2022-02-21  2804  		return true;
3e403a77779faf Veaceslav Falico 2014-07-17  2805  
3e403a77779faf Veaceslav Falico 2014-07-17  2806  	tags++;
3e403a77779faf Veaceslav Falico 2014-07-17  2807  
44a4085538c844 Vlad Yasevich    2014-05-16  2808  	/* Go through all the tags backwards and add them to the packet */
3e403a77779faf Veaceslav Falico 2014-07-17  2809  	while (tags->vlan_proto != VLAN_N_VID) {
3e403a77779faf Veaceslav Falico 2014-07-17  2810  		if (!tags->vlan_id) {
3e403a77779faf Veaceslav Falico 2014-07-17  2811  			tags++;
44a4085538c844 Vlad Yasevich    2014-05-16  2812  			continue;
3e403a77779faf Veaceslav Falico 2014-07-17  2813  		}
44a4085538c844 Vlad Yasevich    2014-05-16  2814  
e2a7420df2e013 Jarod Wilson     2019-06-07  2815  		slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2816  			  ntohs(outer_tag->vlan_proto), tags->vlan_id);
62749e2cb3c4a7 Jiri Pirko       2014-11-19  2817  		skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2818  						tags->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2819  		if (!skb) {
4873ac3c8ed3b0 dingtianhong     2014-03-25  2820  			net_err_ratelimited("failed to insert inner VLAN tag\n");
1fcd5d448c59ca Hangbin Liu      2022-02-21  2821  			return false;
fbd929f2dce460 dingtianhong     2014-03-25  2822  		}
3e403a77779faf Veaceslav Falico 2014-07-17  2823  
3e403a77779faf Veaceslav Falico 2014-07-17  2824  		tags++;
fbd929f2dce460 dingtianhong     2014-03-25  2825  	}
44a4085538c844 Vlad Yasevich    2014-05-16  2826  	/* Set the outer tag */
3e403a77779faf Veaceslav Falico 2014-07-17  2827  	if (outer_tag->vlan_id) {
e2a7420df2e013 Jarod Wilson     2019-06-07  2828  		slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2829  			  ntohs(outer_tag->vlan_proto), outer_tag->vlan_id);
b4bef1b57544b1 Jiri Pirko       2014-11-19  2830  		__vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2831  				       outer_tag->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2832  	}
3e403a77779faf Veaceslav Falico 2014-07-17  2833  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2834  	return true;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2835  }
1fcd5d448c59ca Hangbin Liu      2022-02-21  2836  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-27 23:32 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-27 23:32 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Hangbin Liu <liuhangbin@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   50d602d81f35621042fa0cdae25808662caffda8
commit: 1fcd5d448c59ca2703504806eb8131ce8e411a70 Bonding: split bond_handle_vlan from bond_arp_send
date:   5 weeks ago
:::::: branch date: 2 hours ago
:::::: commit date: 5 weeks ago
config: arm-randconfig-c002-20220325 (https://download.01.org/0day-ci/archive/20220328/202203280750.wtJGjsgw-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1fcd5d448c59ca2703504806eb8131ce8e411a70
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 1fcd5d448c59ca2703504806eb8131ce8e411a70
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   drivers/infiniband/core/cm.c:1130:6: note: Assuming field 'timewait_info' is null
           if (cm_id_priv->timewait_info) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:1130:2: note: Taking false branch
           if (cm_id_priv->timewait_info) {
           ^
   drivers/infiniband/core/cm.c:1136:2: note: Assuming field 'listen_sharecount' is 0
           WARN_ON(cm_id_priv->listen_sharecount);
           ^
   include/asm-generic/bug.h:121:23: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                ^~~~~~~~~~~~
   drivers/infiniband/core/cm.c:1136:2: note: Taking false branch
           WARN_ON(cm_id_priv->listen_sharecount);
           ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/infiniband/core/cm.c:1137:2: note: Assuming '__ret_warn_on' is 0
           WARN_ON(!RB_EMPTY_NODE(&cm_id_priv->service_node));
           ^
   include/asm-generic/bug.h:122:6: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
               ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   drivers/infiniband/core/cm.c:1137:2: note: Taking false branch
           WARN_ON(!RB_EMPTY_NODE(&cm_id_priv->service_node));
           ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/infiniband/core/cm.c:1138:6: note: Assuming the condition is false
           if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:1138:2: note: Taking false branch
           if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node))
           ^
   drivers/infiniband/core/cm.c:1146:2: note: Loop condition is true.  Entering loop body
           while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
           ^
   drivers/infiniband/core/cm.c:1147:3: note: Calling 'cm_free_work'
                   cm_free_work(work);
                   ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:890:6: note: Assuming field 'mad_recv_wc' is null
           if (work->mad_recv_wc)
               ^~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:890:2: note: Taking false branch
           if (work->mad_recv_wc)
           ^
   drivers/infiniband/core/cm.c:892:2: note: Memory is released
           kfree(work);
           ^~~~~~~~~~~
   drivers/infiniband/core/cm.c:1147:3: note: Returning; memory was released
                   cm_free_work(work);
                   ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:1146:17: note: Calling 'cm_dequeue_work'
           while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:880:6: note: Assuming the condition is false
           if (list_empty(&cm_id_priv->work_list))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/cm.c:880:2: note: Taking false branch
           if (list_empty(&cm_id_priv->work_list))
           ^
   drivers/infiniband/core/cm.c:884:2: note: Calling 'list_del'
           list_del(&work->list);
           ^~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:149:14: note: Use of memory after it is freed
           entry->next = LIST_POISON1;
           ~~~~~~~~~~~ ^
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
   drivers/net/ieee802154/mcr20a.c:1118:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ieee802154/mcr20a.c:1118:2: note: Value stored to 'ret' is never read
           ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   20 warnings generated.
   drivers/net/bonding/bond_main.c:1698:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:1698:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(info->slave_name, slave->dev->name);
           ^~~~~~
   drivers/net/bonding/bond_main.c:2799:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2799:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
>> drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2800:21: note: Value stored to 'slave_dev' during its initialization is never read
           struct net_device *slave_dev = slave->dev;
                              ^~~~~~~~~   ~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: warning: Value stored to 'bond_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_main.c:2844:21: note: Value stored to 'bond_dev' during its initialization is never read
           struct net_device *bond_dev = slave->bond->dev;
                              ^~~~~~~~   ~~~~~~~~~~~~~~~~
   Suppressed 16 warnings (16 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   18 warnings generated.
   drivers/net/bonding/bond_3ad.c:671:14: warning: Access to field 'lag_ports' results in a dereference of a null pointer (loaded from variable 'aggregator') [clang-analyzer-core.NullDereference]
           for (port = aggregator->lag_ports; port;
                       ^
   drivers/net/bonding/bond_3ad.c:2335:6: note: Assuming the condition is false
           if (!bond_has_slaves(bond))
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2335:2: note: Taking false branch
           if (!bond_has_slaves(bond))
           ^
   drivers/net/bonding/bond_3ad.c:2338:2: note: Taking false branch
           if (bond_agg_timer_advance(bond)) {
           ^
   drivers/net/bonding/bond_3ad.c:2357:2: note: Loop condition is true.  Entering loop body
           bond_for_each_slave_rcu(bond, slave, iter) {
           ^
   include/net/bonding.h:87:2: note: expanded from macro 'bond_for_each_slave_rcu'
           netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
           ^
   include/linux/netdevice.h:4576:2: note: expanded from macro 'netdev_for_each_lower_private_rcu'
           for (iter = &(dev)->adj_list.lower, \
           ^
   drivers/net/bonding/bond_3ad.c:2359:7: note: Assuming field 'slave' is non-null
                   if (!port->slave) {
                       ^~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:2359:3: note: Taking false branch
                   if (!port->slave) {
                   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Calling 'ad_rx_machine'
                   ad_rx_machine(NULL, port);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1098:6: note: 'lacpdu' is null
           if (lacpdu) {
               ^~~~~~
   drivers/net/bonding/bond_3ad.c:1098:2: note: Taking false branch
           if (lacpdu) {
           ^
   drivers/net/bonding/bond_3ad.c:1105:6: note: Assuming the condition is false
           if (port->sm_vars & AD_PORT_BEGIN) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1105:2: note: Taking false branch
           if (port->sm_vars & AD_PORT_BEGIN) {
           ^
   drivers/net/bonding/bond_3ad.c:1109:13: note: Left side of '&&' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                      ^
   drivers/net/bonding/bond_3ad.c:1109:49: note: Assuming field 'is_enabled' is true
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                                                          ^~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1109:9: note: Taking false branch
           } else if (!(port->sm_vars & AD_PORT_BEGIN) && !port->is_enabled)
                  ^
   drivers/net/bonding/bond_3ad.c:1112:11: note: 'lacpdu' is null
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                    ^~~~~~
   drivers/net/bonding/bond_3ad.c:1112:18: note: Left side of '&&' is false
           else if (lacpdu && ((port->sm_rx_state == AD_RX_EXPIRED) ||
                           ^
   drivers/net/bonding/bond_3ad.c:1121:7: note: Assuming field 'sm_rx_timer_counter' is 0
                   if (port->sm_rx_timer_counter &&
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1121:33: note: Left side of '&&' is false
                   if (port->sm_rx_timer_counter &&
                                                 ^
   drivers/net/bonding/bond_3ad.c:1135:4: note: Control jumps to the 'default' case at line 1145
                           switch (port->sm_rx_state) {
                           ^
   drivers/net/bonding/bond_3ad.c:1146:5: note:  Execution continues on line 1153
                                   break;
                                   ^
   drivers/net/bonding/bond_3ad.c:1153:28: note: 'last_state' is equal to field 'sm_rx_state'
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                     ^~~~~~~~~~
   drivers/net/bonding/bond_3ad.c:1153:6: note: Left side of '||' is false
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
               ^
   drivers/net/bonding/bond_3ad.c:1153:44: note: 'lacpdu' is null
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
                                                     ^~~~~~
   drivers/net/bonding/bond_3ad.c:1153:2: note: Taking false branch
           if ((port->sm_rx_state != last_state) || (lacpdu)) {
           ^
   drivers/net/bonding/bond_3ad.c:1220:1: note: Returning without writing to 'port->aggregator'
   }
   ^
   drivers/net/bonding/bond_3ad.c:2365:3: note: Returning from 'ad_rx_machine'
                   ad_rx_machine(NULL, port);

vim +/slave_dev +2800 drivers/net/bonding/bond_main.c

f5b2b966f032f2 Jay Vosburgh     2006-09-22  2795  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2796  static bool bond_handle_vlan(struct slave *slave, struct bond_vlan_tag *tags,
1fcd5d448c59ca Hangbin Liu      2022-02-21  2797  			     struct sk_buff *skb)
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2798  {
e2a7420df2e013 Jarod Wilson     2019-06-07  2799  	struct net_device *bond_dev = slave->bond->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21 @2800  	struct net_device *slave_dev = slave->dev;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2801  	struct bond_vlan_tag *outer_tag = tags;
44a4085538c844 Vlad Yasevich    2014-05-16  2802  
3e403a77779faf Veaceslav Falico 2014-07-17  2803  	if (!tags || tags->vlan_proto == VLAN_N_VID)
1fcd5d448c59ca Hangbin Liu      2022-02-21  2804  		return true;
3e403a77779faf Veaceslav Falico 2014-07-17  2805  
3e403a77779faf Veaceslav Falico 2014-07-17  2806  	tags++;
3e403a77779faf Veaceslav Falico 2014-07-17  2807  
44a4085538c844 Vlad Yasevich    2014-05-16  2808  	/* Go through all the tags backwards and add them to the packet */
3e403a77779faf Veaceslav Falico 2014-07-17  2809  	while (tags->vlan_proto != VLAN_N_VID) {
3e403a77779faf Veaceslav Falico 2014-07-17  2810  		if (!tags->vlan_id) {
3e403a77779faf Veaceslav Falico 2014-07-17  2811  			tags++;
44a4085538c844 Vlad Yasevich    2014-05-16  2812  			continue;
3e403a77779faf Veaceslav Falico 2014-07-17  2813  		}
44a4085538c844 Vlad Yasevich    2014-05-16  2814  
e2a7420df2e013 Jarod Wilson     2019-06-07  2815  		slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2816  			  ntohs(outer_tag->vlan_proto), tags->vlan_id);
62749e2cb3c4a7 Jiri Pirko       2014-11-19  2817  		skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2818  						tags->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2819  		if (!skb) {
4873ac3c8ed3b0 dingtianhong     2014-03-25  2820  			net_err_ratelimited("failed to insert inner VLAN tag\n");
1fcd5d448c59ca Hangbin Liu      2022-02-21  2821  			return false;
fbd929f2dce460 dingtianhong     2014-03-25  2822  		}
3e403a77779faf Veaceslav Falico 2014-07-17  2823  
3e403a77779faf Veaceslav Falico 2014-07-17  2824  		tags++;
fbd929f2dce460 dingtianhong     2014-03-25  2825  	}
44a4085538c844 Vlad Yasevich    2014-05-16  2826  	/* Set the outer tag */
3e403a77779faf Veaceslav Falico 2014-07-17  2827  	if (outer_tag->vlan_id) {
e2a7420df2e013 Jarod Wilson     2019-06-07  2828  		slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n",
3e403a77779faf Veaceslav Falico 2014-07-17  2829  			  ntohs(outer_tag->vlan_proto), outer_tag->vlan_id);
b4bef1b57544b1 Jiri Pirko       2014-11-19  2830  		__vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto,
3e403a77779faf Veaceslav Falico 2014-07-17  2831  				       outer_tag->vlan_id);
c3ade5cad07f4d Jay Vosburgh     2005-06-26  2832  	}
3e403a77779faf Veaceslav Falico 2014-07-17  2833  
1fcd5d448c59ca Hangbin Liu      2022-02-21  2834  	return true;
1fcd5d448c59ca Hangbin Liu      2022-02-21  2835  }
1fcd5d448c59ca Hangbin Liu      2022-02-21  2836  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-21 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-01  8:02 drivers/net/bonding/bond_main.c:2800:21: warning: Value stored to 'slave_dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-06-21 16:41 kernel test robot
2022-03-27 23:32 kernel test robot

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.