[bug report] net: hns3: add log for setting tx spare buf size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Hao Chen,

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

The patch 2373b35c24ff: "net: hns3: add log for setting tx spare buf 
size" from Apr 19, 2022, leads to the following Smatch complaint:

    drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c:1919 hns3_set_tunable()
    error: we previously assumed 'priv->ring->tx_spare' could be null (see line 1904)

drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
  1903			if (ret ||
  1904			    (!priv->ring->tx_spare && new_tx_spare_buf_size != 0)) {
                             ^^^^^^^^^^^^^^^^^^^^^
Assume priv->ring->tx_spare is NULL but new_tx_spare_buf_size is non-zero.

  1905				int ret1;
  1906	
  1907				netdev_warn(netdev, "change tx spare buf size fail, revert to old value\n");
  1908				ret1 = hns3_set_tx_spare_buf_size(netdev,
  1909								  old_tx_spare_buf_size);
  1910				if (ret1) {
  1911					netdev_err(netdev, "revert to old tx spare buf size fail\n");
  1912					return ret1;
  1913				}
  1914	
  1915				return ret;
  1916			}
  1917	
  1918			netdev_info(netdev, "the actvie tx spare buf size is %u, due to page order\n",
  1919				    priv->ring->tx_spare->len);
                                    ^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference.

  1920	
  1921			break;

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux