diff options
| author | Alex Elder <elder@riscstar.com> | 2026-08-12 11:38:30 -0500 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-08-17 11:21:48 -0700 |
| commit | 0c1f9020d2ada55aed8a2e055903ad9cd5d49dab (patch) | |
| tree | b66acf2133990644847dd31185d31f62b6428c19 | |
| parent | 97a1e65df7eef996693d604ae90aaf2530578912 (diff) | |
| download | linux-0c1f9020d2ada55aed8a2e055903ad9cd5d49dab.tar.gz linux-0c1f9020d2ada55aed8a2e055903ad9cd5d49dab.zip | |
net: stmmac: use dma_addr_t for DMA addresses
In jumbo_frm() (implemented in both "chain_mode.c" and "ring_mode.c"),
an unsigned integer local variable is used to hold the value returned
by dma_map_single(). On systems where a dma_addr_t is 64 bits, the
subsequent dma_mapping_error() check of the returned value operates
only on the low 32 bits (whose high bit won't be sign-extended). In
this case, dma_mapping_error() would return 0 (no error) even if there
were one.
Fix this in both spots by using a dma_addr_t for the local variable.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/linux-devicetree/20260606010122.21A211F00899@smtp.kernel.org/
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20260812163832.271742-2-elder@riscstar.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 3 | ||||
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c index fc04a23342cf..ec25193d287b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c @@ -20,9 +20,10 @@ static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb, unsigned int nopaged_len = skb_headlen(skb); struct stmmac_priv *priv = tx_q->priv_data; unsigned int entry = tx_q->cur_tx; - unsigned int bmax, buf_len, des2; + unsigned int bmax, buf_len; unsigned int i = 1, len; struct dma_desc *desc; + dma_addr_t des2; desc = tx_q->dma_tx + entry; diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index 78fc6aa5bbe9..664d8cfb58cd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c @@ -20,8 +20,9 @@ static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb, unsigned int nopaged_len = skb_headlen(skb); struct stmmac_priv *priv = tx_q->priv_data; unsigned int entry = tx_q->cur_tx; - unsigned int bmax, len, des2; + unsigned int bmax, len; struct dma_desc *desc; + dma_addr_t des2; if (priv->extend_desc) desc = (struct dma_desc *)(tx_q->dma_etx + entry); |
