702-v5.19-15-net-ethernet-mtk_eth_soc-add-check-for-allocation-fa.patch 703 B

12345678910111213141516171819202122
  1. From: Dan Carpenter <[email protected]>
  2. Date: Thu, 21 Apr 2022 18:49:02 +0300
  3. Subject: [PATCH] net: ethernet: mtk_eth_soc: add check for allocation failure
  4. Check if the kzalloc() failed.
  5. Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
  6. Signed-off-by: Dan Carpenter <[email protected]>
  7. Signed-off-by: David S. Miller <[email protected]>
  8. ---
  9. --- a/drivers/net/ethernet/mediatek/mtk_wed.c
  10. +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
  11. @@ -827,6 +827,8 @@ void mtk_wed_add_hw(struct device_node *
  12. goto unlock;
  13. hw = kzalloc(sizeof(*hw), GFP_KERNEL);
  14. + if (!hw)
  15. + goto unlock;
  16. hw->node = np;
  17. hw->regs = regs;
  18. hw->eth = eth;