* [bug report] [NET]: Add Tehuti network driver.
@ 2026-04-10 10:13 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-04-10 10:13 UTC (permalink / raw)
To: Andy Gospodarek; +Cc: netdev
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-10 10:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 10:13 [bug report] [NET]: Add Tehuti network driver Dan Carpenter
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.