[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200624113421.17360-3-ioana.ciornei@nxp.com>
Date: Wed, 24 Jun 2020 14:34:18 +0300
From: Ioana Ciornei <ioana.ciornei@....com>
To: davem@...emloft.net, netdev@...r.kernel.org
Cc: Ioana Ciornei <ioana.ciornei@....com>
Subject: [PATCH net-next 2/5] 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: Ioana Ciornei <ioana.ciornei@....com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index f150cd454fa4..db27f959d409 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -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;
--
2.25.1
Powered by blists - more mailing lists