Re: [kbuild] IB/mlx4: Build the port IBoE GID table properly under bonding

2014-02-18 Thread Dan Carpenter
On Mon, Feb 17, 2014 at 09:52:16PM +0200, Or Gerlitz wrote:
 On Mon, Feb 17, 2014, Dan Carpenter dan.carpen...@oracle.com wrote:
  Hello Moni Shoua,
  This is a semi-automatic email about new static checker warnings.
 
  The patch ad4885d279b6: IB/mlx4: Build the port IBoE GID table
  properly under bonding from Feb 5, 2014, leads to the following
 Smatch complaint:
 
 Hi Dan,
 
 I'd like to act such that our patches go through your 0-day testing of
 static checkers before submissions. For that end, do I just need to
 set up publicly accessible git tree anywhere I like and let you know,
 or it needs to be on kernel.org?
 

So, this wasn't a 0-day thing, right?  I am not sure why 0-day missed
it.  Perhaps the cross function database didn't have enough information.

You'd have to ask Fengguang about 0-day.  I know all the the git trees
in linux-next are a part of 0-day and all the branches get tested.
Presumably you would set up a separate branch for 0-day pre-testing.

Btw, I was so proud of this warning.  It is very complicated for a
static checker to know that curr_netdev is non-NULL on line 1743.

regards,
dan carpenter

 thanks,
 
 Or.
 
 
  drivers/infiniband/hw/mlx4/main.c:1749 mlx4_ib_scan_netdevs()
   error: we previously assumed 'curr_netdev' could be null (see line 
  1722)
 
  drivers/infiniband/hw/mlx4/main.c
1721
1722  if (curr_netdev) {
  ^^^
  Check.
 
1723  port_state = (netif_running(curr_netdev)  
  netif_carrier_ok(curr_netdev)) ?
1724  IB_PORT_ACTIVE : 
  IB_PORT_DOWN;
1725  mlx4_ib_set_default_gid(ibdev, curr_netdev, 
  port);
1726  } else {
1727  reset_gid_table(ibdev, port);
1728  }
1729  /* if using bonding/team and a slave port is down, 
  we don't the bond IP
1730   * based gids in the table since flows that select 
  port by gid may get
1731   * the down port.
1732   */
1733  if (curr_master  (port_state == IB_PORT_DOWN)) {
1734  reset_gid_table(ibdev, port);
1735  mlx4_ib_set_default_gid(ibdev, curr_netdev, 
  port);
1736  }
1737  /* if bonding is used it is possible that we add it 
  to masters
1738   * only after IP address is assigned to the net 
  bonding
1739   * interface.
1740  */
1741  if (curr_master  (old_master != curr_master)) {
1742  reset_gid_table(ibdev, port);
1743  mlx4_ib_set_default_gid(ibdev, curr_netdev, 
  port);
1744  mlx4_ib_get_dev_addr(curr_master, ibdev, 
  port);
1745  }
1746
1747  if (!curr_master  (old_master != curr_master)) {
1748  reset_gid_table(ibdev, port);
1749  mlx4_ib_set_default_gid(ibdev, curr_netdev, 
  port);
 ^^^
  Dereferenced without checking.
 
1750  mlx4_ib_get_dev_addr(curr_netdev, ibdev, 
  port);
1751  }
 
  regards,
  dan carpenter
  --
  To unsubscribe from this list: send the line unsubscribe linux-rdma in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [net-next:master 161/168] net/ieee802154/nl-phy.c:440 phy_set_csma_params() warn: impossible condition '(retries -1) = (0-255 (-1))'

2014-02-18 Thread Dan Carpenter
Hi Phoebe,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   cb6e926e3f734f0934d3cb5cd7c827158183d367
commit: 4244db1b0b7bc9ab7b67d8c1c38de6cf15bc87a8 [161/168] ieee802154: add 
netlink APIs for smartMAC configuration

net/ieee802154/nl-phy.c:440 phy_set_csma_params() warn: impossible condition 
'(retries  -1) = (0-255  (-1))'

git remote add net-next 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
git remote update net-next
git checkout 4244db1b0b7bc9ab7b67d8c1c38de6cf15bc87a8
vim +440 net/ieee802154/nl-phy.c

6ca00197 Phoebe Buckheister 2014-02-17  424  
4244db1b Phoebe Buckheister 2014-02-17  425  static int 
phy_set_csma_params(struct wpan_phy *phy, struct genl_info *info)
4244db1b Phoebe Buckheister 2014-02-17  426  {
4244db1b Phoebe Buckheister 2014-02-17  427 int rc;
4244db1b Phoebe Buckheister 2014-02-17  428 u8 min_be = phy-min_be;
4244db1b Phoebe Buckheister 2014-02-17  429 u8 max_be = phy-max_be;
4244db1b Phoebe Buckheister 2014-02-17  430 u8 retries = phy-csma_retries;
4244db1b Phoebe Buckheister 2014-02-17  431  
4244db1b Phoebe Buckheister 2014-02-17  432 if 
(info-attrs[IEEE802154_ATTR_CSMA_RETRIES])
4244db1b Phoebe Buckheister 2014-02-17  433 retries = 
nla_get_u8(info-attrs[IEEE802154_ATTR_CSMA_RETRIES]);
4244db1b Phoebe Buckheister 2014-02-17  434 if 
(info-attrs[IEEE802154_ATTR_CSMA_MIN_BE])
4244db1b Phoebe Buckheister 2014-02-17  435 min_be = 
nla_get_u8(info-attrs[IEEE802154_ATTR_CSMA_MIN_BE]);
4244db1b Phoebe Buckheister 2014-02-17  436 if 
(info-attrs[IEEE802154_ATTR_CSMA_MAX_BE])
4244db1b Phoebe Buckheister 2014-02-17  437 max_be = 
nla_get_u8(info-attrs[IEEE802154_ATTR_CSMA_MAX_BE]);
4244db1b Phoebe Buckheister 2014-02-17  438  
4244db1b Phoebe Buckheister 2014-02-17  439 if (retries  5 || max_be  8 
|| min_be  max_be ||
4244db1b Phoebe Buckheister 2014-02-17 @440 retries  -1 || retries  7)
4244db1b Phoebe Buckheister 2014-02-17  441 return -EINVAL;
4244db1b Phoebe Buckheister 2014-02-17  442  
4244db1b Phoebe Buckheister 2014-02-17  443 rc = phy-set_csma_params(phy, 
min_be, max_be, retries);
4244db1b Phoebe Buckheister 2014-02-17  444 if (rc  0)
4244db1b Phoebe Buckheister 2014-02-17  445 return rc;
4244db1b Phoebe Buckheister 2014-02-17  446  
4244db1b Phoebe Buckheister 2014-02-17  447 phy-min_be = min_be;
4244db1b Phoebe Buckheister 2014-02-17  448 phy-max_be = max_be;

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [kbuild] net: bcmgenet: add main driver file

2014-02-18 Thread Dan Carpenter
[ Oops.  I sent the last one too quickly.  Here is another I should have
  included. ]

Hello Florian Fainelli,

This is a semi-automatic email about new static checker warnings.

The patch 1c1008c793fa: net: bcmgenet: add main driver file from
Feb 13, 2014, leads to the following Smatch complaint:

drivers/net/ethernet/broadcom/genet/bcmgenet.c:2171 bcmgenet_close()
 error: we previously assumed 'priv-phydev' could be null (see line 
2137)

drivers/net/ethernet/broadcom/genet/bcmgenet.c
  2136  
  2137  if (priv-phydev)

Check.

  2138  phy_stop(priv-phydev);
  2139  
  2140  /* Disable MAC receive */
  2141  reg = bcmgenet_umac_readl(priv, UMAC_CMD);
  2142  reg = ~CMD_RX_EN;
  2143  bcmgenet_umac_writel(priv, reg, UMAC_CMD);
  2144  
  2145  netif_tx_stop_all_queues(dev);
  2146  
  2147  ret = bcmgenet_dma_teardown(priv);
  2148  if (ret)
  2149  return ret;
  2150  
  2151  /* Disable MAC transmit. TX DMA disabled have to done before 
this */
  2152  reg = bcmgenet_umac_readl(priv, UMAC_CMD);
  2153  reg = ~CMD_TX_EN;
  2154  bcmgenet_umac_writel(priv, reg, UMAC_CMD);
  2155  
  2156  napi_disable(priv-napi);
  2157  
  2158  /* tx reclaim */
  2159  bcmgenet_tx_reclaim_all(dev);
  2160  bcmgenet_fini_dma(priv);
  2161  
  2162  free_irq(priv-irq0, priv);
  2163  free_irq(priv-irq1, priv);
  2164  
  2165  /* Wait for pending work items to complete - we are stopping
  2166   * the clock now. Since interrupts are disabled, no new work
  2167   * will be scheduled.
  2168   */
  2169  cancel_work_sync(priv-bcmgenet_irq_work);
  2170  
  2171  if (phy_is_internal(priv-phydev))

Unchecked dereference.

  2172  bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
  2173  

regards,
dan carpenter
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [kbuild] net: bcmgenet: add main driver file

2014-02-18 Thread Dan Carpenter
Hello Florian Fainelli,

This is a semi-automatic email about new static checker warnings.

The patch 1c1008c793fa: net: bcmgenet: add main driver file from
Feb 13, 2014, leads to the following Smatch complaint:

drivers/net/ethernet/broadcom/genet/bcmgenet.c:2061 bcmgenet_open()
 warn: variable dereferenced before check 'priv-phydev' (see line 2014)

drivers/net/ethernet/broadcom/genet/bcmgenet.c
  2052  priv-crc_fwd_en = !!(reg  CMD_CRC_FWD);
  2053  
  2054  device_set_wakeup_capable(dev-dev, 1);
  2055  
  2056  if (phy_is_internal(priv-phydev))

Dereference.

  2057  bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
  2058  
  2059  netif_tx_start_all_queues(dev);
  2060  
  2061  if (priv-phydev)

Check.

  2062  phy_start(priv-phydev);
  2063  

regards,
dan carpenter
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [net-next:master 77/82] net/tipc/socket.c:1572 tipc_connect() warn: missing break? reassigning 'res'

2014-02-18 Thread kbuild test robot
TO: Ying Xue ying@windriver.com


Hi Ying,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   f7b12606b5de323a2bb5ca1696558efde8f25441
commit: 247f0f3c3176c55b46cb9a20011d3d6757634815 [77/82] tipc: align tipc 
function names with common naming practice in the network
:: branch date: 16 minutes ago
:: commit date: 60 minutes ago

net/tipc/socket.c:1572 tipc_connect() warn: missing break? reassigning 'res'

git remote add net-next 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
git remote update net-next
git checkout 247f0f3c3176c55b46cb9a20011d3d6757634815
vim +/res +1572 net/tipc/socket.c

584d24b3 Ying Xue 2012-11-29  1556   * indicate send_msg() is never 
blocked.
584d24b3 Ying Xue 2012-11-29  1557   */
584d24b3 Ying Xue 2012-11-29  1558  if (!timeout)
584d24b3 Ying Xue 2012-11-29  1559  m.msg_flags = 
MSG_DONTWAIT;
584d24b3 Ying Xue 2012-11-29  1560  
247f0f3c Ying Xue 2014-02-18  1561  res = tipc_sendmsg(NULL, sock, 
m, 0);
584d24b3 Ying Xue 2012-11-29  1562  if ((res  0)  (res != 
-EWOULDBLOCK))
584d24b3 Ying Xue 2012-11-29  1563  goto exit;
584d24b3 Ying Xue 2012-11-29  1564  
584d24b3 Ying Xue 2012-11-29  1565  /* Just entered SS_CONNECTING 
state; the only
584d24b3 Ying Xue 2012-11-29  1566   * difference is that return 
value in non-blocking
584d24b3 Ying Xue 2012-11-29  1567   * case is EINPROGRESS, rather 
than EALREADY.
584d24b3 Ying Xue 2012-11-29  1568   */
584d24b3 Ying Xue 2012-11-29  1569  res = -EINPROGRESS;
584d24b3 Ying Xue 2012-11-29  1570  case SS_CONNECTING:
78eb3a53 Ying Xue 2014-01-17  1571  if (previous == SS_CONNECTING)
78eb3a53 Ying Xue 2014-01-17 @1572  res = -EALREADY;
78eb3a53 Ying Xue 2014-01-17  1573  if (!timeout)
78eb3a53 Ying Xue 2014-01-17  1574  goto exit;
78eb3a53 Ying Xue 2014-01-17  1575  timeout = 
msecs_to_jiffies(timeout);
78eb3a53 Ying Xue 2014-01-17  1576  /* Wait until an 'ACK' or 'RST' 
arrives, or a timeout occurs */
78eb3a53 Ying Xue 2014-01-17  1577  res = 
tipc_wait_for_connect(sock, timeout);
584d24b3 Ying Xue 2012-11-29  1578  break;
584d24b3 Ying Xue 2012-11-29  1579  case SS_CONNECTED:
584d24b3 Ying Xue 2012-11-29  1580  res = -EISCONN;

:: The code at line 1572 was first introduced by commit
:: 78eb3a5379a52f291556483ea55b8a37e2ed4d5b tipc: standardize connect 
routine

:: TO: Ying Xue ying@windriver.com
:: CC: David S. Miller da...@davemloft.net

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [net-next:master 77/82] net/tipc/port.c:567:9: sparse: context imbalance in 'tipc_port_proto_rcv' - unexpected unlock

2014-02-18 Thread kbuild test robot
TO: Ying Xue ying@windriver.com


Hi Ying,

FYI, there are new sparse warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   f7b12606b5de323a2bb5ca1696558efde8f25441
commit: 247f0f3c3176c55b46cb9a20011d3d6757634815 [77/82] tipc: align tipc 
function names with common naming practice in the network
reproduce: make C=1 CF=-D__CHECK_ENDIAN__
:: branch date: 3 hours ago
:: commit date: 4 hours ago

   net/tipc/msg.h:112:28: sparse: incorrect type in initializer (different base 
types)
   net/tipc/msg.h:112:28:expected unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28:got restricted __be32 noident
   net/tipc/msg.h:115:21: sparse: incorrect type in assignment (different base 
types)
   net/tipc/msg.h:115:21:expected restricted __be32 noident
   net/tipc/msg.h:115:21:got unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28: sparse: incorrect type in initializer (different base 
types)
   net/tipc/msg.h:112:28:expected unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28:got restricted __be32 noident
   net/tipc/msg.h:115:21: sparse: incorrect type in assignment (different base 
types)
   net/tipc/msg.h:115:21:expected restricted __be32 noident
   net/tipc/msg.h:115:21:got unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28: sparse: incorrect type in initializer (different base 
types)
   net/tipc/msg.h:112:28:expected unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28:got restricted __be32 noident
   net/tipc/msg.h:115:21: sparse: incorrect type in assignment (different base 
types)
   net/tipc/msg.h:115:21:expected restricted __be32 noident
   net/tipc/msg.h:115:21:got unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28: sparse: incorrect type in initializer (different base 
types)
   net/tipc/msg.h:112:28:expected unsigned int [unsigned] [usertype] temp
   net/tipc/msg.h:112:28:got restricted __be32 noident
   net/tipc/msg.h:115:21: sparse: incorrect type in assignment (different base 
types)
   net/tipc/msg.h:115:21:expected restricted __be32 noident
   net/tipc/msg.h:115:21:got unsigned int [unsigned] [usertype] temp
   net/tipc/port.c:293:9: sparse: context imbalance in 'tipc_portunreliable' - 
unexpected unlock
   net/tipc/port.c:305:30: sparse: context imbalance in 
'tipc_set_portunreliable' - unexpected unlock
   net/tipc/port.c:322:9: sparse: context imbalance in 'tipc_portunreturnable' 
- unexpected unlock
   net/tipc/port.c:334:31: sparse: context imbalance in 
'tipc_set_portunreturnable' - unexpected unlock
   net/tipc/port.c:418:41: sparse: context imbalance in 'tipc_reject_msg' - 
unexpected unlock
   net/tipc/port.c:469:25: sparse: context imbalance in 'port_timeout' - 
unexpected unlock
   net/tipc/port.c:481:9: sparse: context imbalance in 'port_handle_node_down' 
- unexpected unlock
 net/tipc/port.c:567:9: sparse: context imbalance in 'tipc_port_proto_rcv' - 
 unexpected unlock
   net/tipc/port.c:673:25: sparse: context imbalance in 'tipc_acknowledge' - 
unexpected unlock
   net/tipc/port.c:684:51: sparse: context imbalance in 'tipc_portimportance' - 
unexpected unlock
   net/tipc/port.c:699:27: sparse: context imbalance in 
'tipc_set_portimportance' - unexpected unlock
 net/tipc/port.c:772:9: sparse: context imbalance in 'tipc_port_connect' - 
 unexpected unlock
 net/tipc/port.c:843:9: sparse: context imbalance in 'tipc_port_disconnect' - 
 unexpected unlock
 net/tipc/port.c:860:9: sparse: context imbalance in 'tipc_port_shutdown' - 
 unexpected unlock
 net/tipc/port.c:886:17: sparse: context imbalance in 'tipc_port_rcv' - 
 unexpected unlock

git remote add net-next 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
git remote update net-next
git checkout 247f0f3c3176c55b46cb9a20011d3d6757634815
vim +/tipc_port_proto_rcv +567 net/tipc/port.c

b97bf3fd Per Liden  2006-01-02  412  
b97bf3fd Per Liden  2006-01-02  413 if (p_ptr) {
dff10e9e Allan Stephens 2011-11-02  414 struct sk_buff 
*abuf = NULL;
dff10e9e Allan Stephens 2011-11-02  415  
23dd4cce Allan Stephens 2011-01-07  416 if 
(p_ptr-connected)
b97bf3fd Per Liden  2006-01-02  417 abuf = 
port_build_self_abort_msg(p_ptr, err);
4323add6 Per Liden  2006-01-18 @418 
tipc_port_unlock(p_ptr);
dff10e9e Allan Stephens 2011-11-02  419 
tipc_net_route_msg(abuf);
b97bf3fd Per Liden  2006-01-02  420 }
b97bf3fd Per Liden  2006-01-02  421 }
b97bf3fd Per Liden  2006-01-02  422  
acc631bf Allan Stephens 2011-05-23  423 /* send returned message  
dispose of rejected message */
017dac31 Allan Stephens 2011-05-24  424 src_node = msg_prevnode(msg);
630d920d Allan Stephens 2012-04-18  425 if (in_own_node(src_node))