Skip to content

Commit

Permalink
dpaa2-eth: check the result of skb_to_sgvec()
Browse files Browse the repository at this point in the history
Before passing the result of skb_to_sgvec() to dma_map_sg() check if any
error was returned.

Signed-off-by: Ioana Ciornei <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
IoanaCiornei authored and davem330 committed Jun 25, 2020
1 parent 0da1e28 commit 37fbbdd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,

sg_init_table(scl, nr_frags + 1);
num_sg = skb_to_sgvec(skb, scl, 0, skb->len);
if (unlikely(num_sg < 0)) {
err = -ENOMEM;
goto dma_map_sg_failed;
}
num_dma_bufs = dma_map_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL);
if (unlikely(!num_dma_bufs)) {
err = -ENOMEM;
Expand Down

0 comments on commit 37fbbdd

Please sign in to comment.