lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200831123317.GL8299@kadam>
Date:   Mon, 31 Aug 2020 15:33:18 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Vladimir Oltean <vladimir.oltean@....com>
Cc:     lkp@...el.com, Dan Carpenter <error27@...il.com>,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Russell King <rmk+kernel@...linux.org.uk>
Subject: drivers/net/dsa/sja1105/sja1105_main.c:1608
 sja1105_static_config_reload() warn: bitwise AND condition is false here

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4d41ead6ead97c3730bbd186a601a64828668f01
commit: ffe10e679cec9a99f19049459cb27c2fbb1e913a net: dsa: sja1105: Add support for the SGMII port
config: arm-randconfig-m031-20200829 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

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

New smatch warnings:
drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe10e679cec9a99f19049459cb27c2fbb1e913a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ffe10e679cec9a99f19049459cb27c2fbb1e913a
vim +1608 drivers/net/dsa/sja1105/sja1105_main.c

6666cebc5e306f Vladimir Oltean 2019-05-02  1590  	for (i = 0; i < SJA1105_NUM_PORTS; i++) {
8400cff60b472c Vladimir Oltean 2019-06-08  1591  		rc = sja1105_adjust_port_config(priv, i, speed_mbps[i]);
6666cebc5e306f Vladimir Oltean 2019-05-02  1592  		if (rc < 0)
6666cebc5e306f Vladimir Oltean 2019-05-02  1593  			goto out;
6666cebc5e306f Vladimir Oltean 2019-05-02  1594  	}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1595  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1596  	if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1597  		bool an_enabled = !!(bmcr & BMCR_ANENABLE);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1598  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1599  		sja1105_sgmii_pcs_config(priv, an_enabled, false);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1600  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1601  		if (!an_enabled) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1602  			int speed = SPEED_UNKNOWN;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1603  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1604  			if (bmcr & BMCR_SPEED1000)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1605  				speed = SPEED_1000;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1606  			else if (bmcr & BMCR_SPEED100)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1607  				speed = SPEED_100;
ffe10e679cec9a Vladimir Oltean 2020-03-20 @1608  			else if (bmcr & BMCR_SPEED10)
                                                                                 ^^^^^^^^^^^^^^^^^^^
This is an impossible condition.  BMCR_SPEED10 is zero.

ffe10e679cec9a Vladimir Oltean 2020-03-20  1609  				speed = SPEED_10;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1610  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1611  			sja1105_sgmii_pcs_force_speed(priv, speed);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1612  		}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1613  	}
6666cebc5e306f Vladimir Oltean 2019-05-02  1614  out:
af580ae2dcb250 Vladimir Oltean 2019-11-09  1615  	mutex_unlock(&priv->mgmt_lock);
af580ae2dcb250 Vladimir Oltean 2019-11-09  1616  
6666cebc5e306f Vladimir Oltean 2019-05-02  1617  	return rc;
6666cebc5e306f Vladimir Oltean 2019-05-02  1618  }

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

Download attachment ".config.gz" of type "application/gzip" (24564 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ