Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39ee6e82 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

net: hns3: Check for allocation failure



We should return -ENOMEM if the kcalloc() fails.

Fixes: d174ea75 ("net: hns3: add statistics for PFC frames and MAC control frame")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef76c77a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ static int hclge_mac_update_stats_complete(struct hclge_dev *hdev, u32 desc_num)
	int ret;

	desc = kcalloc(desc_num, sizeof(struct hclge_desc), GFP_KERNEL);
	if (!desc)
		return -ENOMEM;
	hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_STATS_MAC_ALL, true);
	ret = hclge_cmd_send(&hdev->hw, desc, desc_num);
	if (ret) {