Commit b40d7af7 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David S. Miller
Browse files

net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'



If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.

Fixes: 2e2deee7 ("net: hns3: add the RAS compatibility adaptation solution")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarJiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ebe9d9eb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2330,8 +2330,10 @@ int hclge_handle_error_info_log(struct hnae3_ae_dev *ae_dev)
	buf_size = buf_len / sizeof(u32);

	desc_data = kzalloc(buf_len, GFP_KERNEL);
	if (!desc_data)
		return -ENOMEM;
	if (!desc_data) {
		ret = -ENOMEM;
		goto err_desc;
	}

	buf = kzalloc(buf_len, GFP_KERNEL);
	if (!buf) {