All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Andy Gospodarek <andy@greyhouse.net>
Cc: netdev@vger.kernel.org
Subject: [bug report] [NET]: Add Tehuti network driver.
Date: Fri, 10 Apr 2026 13:13:03 +0300	[thread overview]
Message-ID: <adjNL2q19v23xsAv@stanley.mountain> (raw)

Hello Andy Gospodarek,

Commit 1a348ccc1047 ("[NET]: Add Tehuti network driver.") from Sep
17, 2007 (linux-next), leads to the following Smatch static checker
warning:

	drivers/net/ethernet/tehuti/tehuti.c:2210 bdx_set_coalesce()
	warn: no lower bound on 'rx_max_coal' rl='s32min-15'

drivers/net/ethernet/tehuti/tehuti.c
    2179 static int bdx_set_coalesce(struct net_device *netdev,
    2180                             struct ethtool_coalesce *ecoal,
    2181                             struct kernel_ethtool_coalesce *kernel_coal,
    2182                             struct netlink_ext_ack *extack)
    2183 {
    2184         u32 rdintcm;
    2185         u32 tdintcm;
    2186         struct bdx_priv *priv = netdev_priv(netdev);
    2187         int rx_coal;
    2188         int tx_coal;
    2189         int rx_max_coal;
    2190         int tx_max_coal;
    2191 
    2192         /* Check for valid input */
    2193         rx_coal = ecoal->rx_coalesce_usecs / INT_COAL_MULT;
    2194         tx_coal = ecoal->tx_coalesce_usecs / INT_COAL_MULT;
    2195         rx_max_coal = ecoal->rx_max_coalesced_frames
    2196         tx_max_coal = ecoal->tx_max_coalesced_frames;
    2197 
    2198         /* Translate from packets to multiples of FIFO bytes */
    2199         rx_max_coal =
    2200             (((rx_max_coal * sizeof(struct rxf_desc)) + PCK_TH_MULT - 1)
    2201              / PCK_TH_MULT);
    2202         tx_max_coal =
    2203             (((tx_max_coal * BDX_TXF_DESC_SZ) + PCK_TH_MULT - 1)
    2204              / PCK_TH_MULT);
    2205 
    2206         if ((rx_coal > 0x7FFF) || (tx_coal > 0x7FFF) ||
    2207             (rx_max_coal > 0xF) || (tx_max_coal > 0xF))

Check rx_max_coal and tx_max_coal for negative values?

    2208                 return -EINVAL;
    2209 
--> 2210         rdintcm = INT_REG_VAL(rx_coal, GET_INT_COAL_RC(priv->rdintcm),
    2211                               GET_RXF_TH(priv->rdintcm), rx_max_coal);
                                                                  ^^^^^^^^^^^

    2212         tdintcm = INT_REG_VAL(tx_coal, GET_INT_COAL_RC(priv->tdintcm), 0,
    2213                               tx_max_coal);
    2214 
    2215         priv->rdintcm = rdintcm;
    2216         priv->tdintcm = tdintcm;
    2217 
    2218         WRITE_REG(priv, regRDINTCM0, rdintcm);
    2219         WRITE_REG(priv, regTDINTCM0, tdintcm);
    2220 
    2221         return 0;
    2222 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10 10:13 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=adjNL2q19v23xsAv@stanley.mountain \
    --to=error27@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=netdev@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.