Commit 37fbbdda authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller

dpaa2-eth: check the result of skb_to_sgvec()

Before passing the result of skb_to_sgvec() to dma_map_sg() check if any
error was returned.
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0da1e28f
...@@ -611,6 +611,10 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, ...@@ -611,6 +611,10 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
sg_init_table(scl, nr_frags + 1); sg_init_table(scl, nr_frags + 1);
num_sg = skb_to_sgvec(skb, scl, 0, skb->len); 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); num_dma_bufs = dma_map_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL);
if (unlikely(!num_dma_bufs)) { if (unlikely(!num_dma_bufs)) {
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment