From: Krzysztof Kozlowski <krzk@kernel.org>
To: Charles Han <hanchunchao@inspur.com>,
s.nawrocki@samsung.com, a.swigon@samsung.com, djakov@kernel.org,
alim.akhtar@samsung.com, cw00.choi@samsung.com
Cc: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] interconnect: samsung: Add NULL check in exynos_generic_icc_probe
Date: Thu, 10 Apr 2025 14:16:42 +0200 [thread overview]
Message-ID: <9cc33c4b-05e6-4203-8762-205eb3d4e9df@kernel.org> (raw)
In-Reply-To: <20250410110421.77580-1-hanchunchao@inspur.com>
On 10/04/2025 13:04, Charles Han wrote:
> devm_kasprintf() can return a NULL pointer on failure,but this
> returned value in exynos_generic_icc_probe() is not checked.
> Add NULL check in exynos_generic_icc_probe(), to handle kernel NULL
> pointer dereference error.
>
> Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
> drivers/interconnect/samsung/exynos.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/interconnect/samsung/exynos.c b/drivers/interconnect/samsung/exynos.c
> index 9e041365d909..f3568f0d92d1 100644
> --- a/drivers/interconnect/samsung/exynos.c
> +++ b/drivers/interconnect/samsung/exynos.c
> @@ -134,6 +134,11 @@ static int exynos_generic_icc_probe(struct platform_device *pdev)
> priv->node = icc_node;
> icc_node->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
> bus_dev->of_node);
> + if (!icc_node->name) {
> + devm_kfree(&pdev->dev, priv);
Instead of doing some scripting changes you need to look at the code.
Look at other error paths, how they are doing it.
Otherwise please explain why you need to release a managed resource?
Best regards,
Krzysztof
prev parent reply other threads:[~2025-04-10 12:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 11:04 Charles Han
2025-04-10 12:16 ` Krzysztof Kozlowski [this message]
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=9cc33c4b-05e6-4203-8762-205eb3d4e9df@kernel.org \
--to=krzk@kernel.org \
--cc=a.swigon@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=djakov@kernel.org \
--cc=hanchunchao@inspur.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=s.nawrocki@samsung.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
all inboxes | Powered by JetHome®