From: Zhou Yanjie <zhouyanjie@wanyeetech.com>
To: Wei Yongjun <weiyongjun1@huawei.com>,
mpm@selenic.com, herbert@gondor.apana.org.au, arnd@arndb.de,
gregkh@linuxfoundation.org, prasannatsmkumar@gmail.com
Cc: linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org,
Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] crypto: ingenic - Drop kfree for memory allocated with devm_kzalloc
Date: Fri, 7 Aug 2020 23:57:27 +0800 [thread overview]
Message-ID: <dc81addf-28db-72ef-1181-5b6425374e3c@wanyeetech.com> (raw)
In-Reply-To: <20200804081153.45342-1-weiyongjun1@huawei.com>
Hello,
在 2020/8/4 下午4:11, Wei Yongjun 写道:
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
Thanks for fix it.
Reviewed-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>
> Fixes: 190873a0ea45 ("crypto: ingenic - Add hardware RNG for Ingenic JZ4780 and X1000")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/char/hw_random/ingenic-rng.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/char/hw_random/ingenic-rng.c b/drivers/char/hw_random/ingenic-rng.c
> index d704cef64b64..055cfe59f519 100644
> --- a/drivers/char/hw_random/ingenic-rng.c
> +++ b/drivers/char/hw_random/ingenic-rng.c
> @@ -92,8 +92,7 @@ static int ingenic_rng_probe(struct platform_device *pdev)
> priv->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(priv->base)) {
> pr_err("%s: Failed to map RNG registers\n", __func__);
> - ret = PTR_ERR(priv->base);
> - goto err_free_rng;
> + return PTR_ERR(priv->base);
> }
>
> priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev);
> @@ -106,17 +105,13 @@ static int ingenic_rng_probe(struct platform_device *pdev)
> ret = hwrng_register(&priv->rng);
> if (ret) {
> dev_err(&pdev->dev, "Failed to register hwrng\n");
> - goto err_free_rng;
> + return ret;
> }
>
> platform_set_drvdata(pdev, priv);
>
> dev_info(&pdev->dev, "Ingenic RNG driver registered\n");
> return 0;
> -
> -err_free_rng:
> - kfree(priv);
> - return ret;
> }
>
> static int ingenic_rng_remove(struct platform_device *pdev)
>
>
next prev parent reply other threads:[~2020-08-07 15:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-04 8:11 [PATCH] crypto: ingenic - Drop kfree for memory allocated with devm_kzalloc Wei Yongjun
2020-08-07 15:57 ` Zhou Yanjie [this message]
2020-08-21 7:56 ` Herbert Xu
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=dc81addf-28db-72ef-1181-5b6425374e3c@wanyeetech.com \
--to=zhouyanjie@wanyeetech.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=hulkci@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=prasannatsmkumar@gmail.com \
--cc=weiyongjun1@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).