Skip to content

Commit 143c253

Browse files
XidianGeneraldavem330
authored andcommitted
net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch()
When hns_assemble_skb() returns NULL to skb, no error return code of hns_nic_clear_all_rx_fetch() is assigned. To fix this bug, ret is assigned with -ENOMEM in this case. Reported-by: TOTE Robot <[email protected]> Signed-off-by: Jia-Ju Bai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4d8c79b commit 143c253

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev)
16631663
for (j = 0; j < fetch_num; j++) {
16641664
/* alloc one skb and init */
16651665
skb = hns_assemble_skb(ndev);
1666-
if (!skb)
1666+
if (!skb) {
1667+
ret = -ENOMEM;
16671668
goto out;
1669+
}
16681670
rd = &tx_ring_data(priv, skb->queue_mapping);
16691671
hns_nic_net_xmit_hw(ndev, skb, rd);
16701672

0 commit comments

Comments
 (0)