From: zhangjiaran <zhangjiaran@huawei.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
<yisen.zhuang@huawei.com>, <salil.mehta@huawei.com>,
<davem@davemloft.net>, <kuba@kernel.org>,
<huangguangbin2@huawei.com>, <tanhuazhong@huawei.com>,
<moyufeng@huawei.com>, <lipeng321@huawei.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'
Date: Mon, 21 Jun 2021 20:41:45 +0800 [thread overview]
Message-ID: <af5fc070-515b-cca8-bf67-ad69b46f2ce7@huawei.com> (raw)
In-Reply-To: <bcf0186881d4a735fb1d356546c0cf00da40bb36.1624182453.git.christophe.jaillet@wanadoo.fr>
在 2021/6/20 17:49, Christophe JAILLET 写道:
> If this 'kzalloc()' fails we must free some resources as in all the other
> error handling paths of this function.
>
> Fixes: 2e2deee7618b ("net: hns3: add the RAS compatibility adaptation solution")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> index bad9fda19398..ec9a7f8bc3fe 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> @@ -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) {
>
Reviewed-by: Jiaran Zhang <zhangjiaran@huawei.com>
next prev parent reply other threads:[~2021-06-21 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-20 9:49 [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()' Christophe JAILLET
2021-06-21 12:41 ` zhangjiaran [this message]
2021-06-21 21:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=af5fc070-515b-cca8-bf67-ad69b46f2ce7@huawei.com \
--to=zhangjiaran@huawei.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=huangguangbin2@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lipeng321@huawei.com \
--cc=moyufeng@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@huawei.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).