Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ag71xx: Add missing check after DMA map

The DMA map functions can fail and should be tested for errors.

Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250716095733.37452-3-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Fourier and committed by
Jakub Kicinski
96a1e15e b6645645

+9
+9
drivers/net/ethernet/atheros/ag71xx.c
··· 1213 1213 buf->rx.rx_buf = data; 1214 1214 buf->rx.dma_addr = dma_map_single(&ag->pdev->dev, data, ag->rx_buf_size, 1215 1215 DMA_FROM_DEVICE); 1216 + if (dma_mapping_error(&ag->pdev->dev, buf->rx.dma_addr)) { 1217 + skb_free_frag(data); 1218 + buf->rx.rx_buf = NULL; 1219 + return false; 1220 + } 1216 1221 desc->data = (u32)buf->rx.dma_addr + offset; 1217 1222 return true; 1218 1223 } ··· 1516 1511 1517 1512 dma_addr = dma_map_single(&ag->pdev->dev, skb->data, skb->len, 1518 1513 DMA_TO_DEVICE); 1514 + if (dma_mapping_error(&ag->pdev->dev, dma_addr)) { 1515 + netif_dbg(ag, tx_err, ndev, "DMA mapping error\n"); 1516 + goto err_drop; 1517 + } 1519 1518 1520 1519 i = ring->curr & ring_mask; 1521 1520 desc = ag71xx_ring_desc(ring, i);