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: <20201007074228.GO4282@kadam>
Date:   Wed, 7 Oct 2020 10:42:28 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Kees Cook <keescook@...omium.org>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:5638
 bnx2x_link_settings_status() warn: signedness bug returning '(-22)'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d3d45f8220d60a0b2aaaacf8fb2be4e6ffd9008e
commit: 2c855d73f2f6107f5b8ebc45f8b934bf7f4419e0 bnx2x: Remove read_status_t function casts
config: x86_64-randconfig-m001-20201003 (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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

New smatch warnings:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:5638 bnx2x_link_settings_status() warn: signedness bug returning '(-22)'

Old smatch warnings:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:7184 bnx2x_8073_8727_external_rom_boot() error: uninitialized symbol 'fw_ver1'.

vim +5638 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c

2c855d73f2f6107 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Kees Cook        2019-11-14  5614  static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy,
                                                                                                           ^^

3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5615  				     struct link_params *params,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5616  				     struct link_vars *vars)
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5617  {
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5618  	struct bnx2x *bp = params->bp;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5619  
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5620  	u16 gp_status, duplex = DUPLEX_HALF, link_up = 0, speed_mask;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5621  	int rc = 0;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5622  
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5623  	/* Read gp_status */
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5624  	CL22_RD_OVER_CL45(bp, phy,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5625  			  MDIO_REG_BANK_GP_STATUS,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5626  			  MDIO_GP_STATUS_TOP_AN_STATUS1,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5627  			  &gp_status);
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5628  	if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_DUPLEX_STATUS)
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5629  		duplex = DUPLEX_FULL;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5630  	if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS)
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5631  		link_up = 1;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5632  	speed_mask = gp_status & GP_STATUS_SPEED_MASK;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5633  	DP(NETIF_MSG_LINK, "gp_status 0x%x, is_link_up %d, speed_mask 0x%x\n",
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5634  		       gp_status, link_up, speed_mask);
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5635  	rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, speed_mask,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5636  					 duplex);
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5637  	if (rc == -EINVAL)
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14 @5638  		return rc;
                                                                                                                ^^^^^^^^^^
return -EINVAL gets truncated to a u8.

3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5639  
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5640  	if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS) {
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5641  		if (SINGLE_MEDIA_DIRECT(params)) {
430d172a635c3dd drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Yaniv Rosner     2012-09-11  5642  			vars->duplex = duplex;
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5643  			bnx2x_flow_ctrl_resolve(phy, params, vars, gp_status);
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5644  			if (phy->req_line_speed == SPEED_AUTO_NEG)
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5645  				bnx2x_xgxs_an_resolve(phy, params, vars,
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5646  						      gp_status);
3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2011-06-14  5647  		}
d231023eb17134e drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Yuval Mintz      2012-06-20  5648  	} else { /* Link_down */
c18aa15d08a2d1a drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2010-09-07  5649  		if ((phy->req_line_speed == SPEED_AUTO_NEG) &&
c18aa15d08a2d1a drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2010-09-07  5650  		    SINGLE_MEDIA_DIRECT(params)) {
239d686d494f10e drivers/net/bnx2x_link.c                         Eilon Greenstein 2009-08-12  5651  			/* Check signal is detected */
c18aa15d08a2d1a drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2010-09-07  5652  			bnx2x_check_fallback_to_cl37(phy, params);
239d686d494f10e drivers/net/bnx2x_link.c                         Eilon Greenstein 2009-08-12  5653  		}
ea4e040abc72f2d drivers/net/bnx2x_link.c                         Yaniv Rosner     2008-06-23  5654  	}
ea4e040abc72f2d drivers/net/bnx2x_link.c                         Yaniv Rosner     2008-06-23  5655  
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5656  	/* Read LP advertised speeds*/
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5657  	if (SINGLE_MEDIA_DIRECT(params) &&
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5658  	    (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE)) {
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5659  		u16 val;
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5660  
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5661  		CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_CL73_IEEEB1,
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5662  				  MDIO_CL73_IEEEB1_AN_LP_ADV2, &val);
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5663  
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5664  		if (val & MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX)
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5665  			vars->link_status |=
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5666  				LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE;
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5667  		if (val & (MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4 |
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5668  			   MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KR))
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5669  			vars->link_status |=
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5670  				LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5671  
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5672  		CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_OVER_1G,
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5673  				  MDIO_OVER_1G_LP_UP1, &val);
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5674  
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5675  		if (val & MDIO_OVER_1G_UP1_2_5G)
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5676  			vars->link_status |=
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5677  				LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE;
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5678  		if (val & (MDIO_OVER_1G_UP1_10G | MDIO_OVER_1G_UP1_10GH))
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5679  			vars->link_status |=
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5680  				LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5681  	}
9e7e8399c5d3c4d drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Mintz Yuval      2012-02-15  5682  
a22f078867ef362 drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2010-09-07  5683  	DP(NETIF_MSG_LINK, "duplex %x  flow_ctrl 0x%x link_status 0x%x\n",
a22f078867ef362 drivers/net/bnx2x/bnx2x_link.c                   Yaniv Rosner     2010-09-07  5684  		   vars->duplex, vars->flow_ctrl, vars->link_status);
ea4e040abc72f2d drivers/net/bnx2x_link.c                         Yaniv Rosner     2008-06-23  5685  	return rc;
ea4e040abc72f2d drivers/net/bnx2x_link.c                         Yaniv Rosner     2008-06-23  5686  }

---
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" (29710 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ