All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: chenhao288@hisilicon.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: hns3: add log for setting tx spare buf size
Date: Fri, 22 Apr 2022 18:46:47 +0300	[thread overview]
Message-ID: <YmLN5zB2iVpp/qy/@kili> (raw)

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

                 reply	other threads:[~2022-04-22 15:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YmLN5zB2iVpp/qy/@kili \
    --to=dan.carpenter@oracle.com \
    --cc=chenhao288@hisilicon.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.