From: Feng Liu <Feng.Liu3@windriver.com>
To: chentao@kylinos.cn, ulf.hansson@linaro.org, sashal@kernel.org,
Feng.Liu3@windriver.com, Zhe.He@windriver.com
Cc: stable@vger.kernel.org
Subject: [PATCH 5.10.y/5.15.y] pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
Date: Wed, 23 Apr 2025 09:04:10 +0800 [thread overview]
Message-ID: <20250423010410.2131206-1-Feng.Liu3@windriver.com> (raw)
From: Kunwu Chan <chentao@kylinos.cn>
[ Upstream commit 5d7f58ee08434a33340f75ac7ac5071eea9673b3 ]
devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240118054257.200814-1-chentao@kylinos.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[Minor context change fixed]
Signed-off-by: Feng Liu <Feng.Liu3@windriver.com>
Signed-off-by: He Zhe <Zhe.He@windriver.com>
---
Verified the build test.
---
drivers/soc/ti/omap_prm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
index 4a782bfd753c..d4c0c700b35c 100644
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -381,6 +381,8 @@ static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
data = prm->data;
name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
data->name);
+ if (!name)
+ return -ENOMEM;
prmd->dev = dev;
prmd->prm = prm;
--
2.34.1
next reply other threads:[~2025-04-23 1:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 1:04 Feng Liu [this message]
2025-04-23 12:17 ` [PATCH 5.10.y/5.15.y] pmdomain: ti: Add a null pointer check to the omap_prm_domain_init Sasha Levin
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=20250423010410.2131206-1-Feng.Liu3@windriver.com \
--to=feng.liu3@windriver.com \
--cc=Zhe.He@windriver.com \
--cc=chentao@kylinos.cn \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.