From: Markus Elfring <Markus.Elfring@web.de>
To: linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Linus Walleij <linus.walleij@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh@kernel.org>, Stephen Boyd <sboyd@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Kunwu Chan <chentao@kylinos.cn>
Subject: [PATCH 1/2] clk: versatile: clk-icst: Return directly after a failed kasprintf() call in of_syscon_icst_setup()
Date: Wed, 17 Jan 2024 18:41:47 +0100 [thread overview]
Message-ID: <be06e4cf-2e36-4884-bcd0-5d5eb5f191cd@web.de> (raw)
In-Reply-To: <061aef8b-a41f-4346-af6e-560c7594b27b@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Jan 2024 18:06:55 +0100
The result from a call of the function “kasprintf” was passed to
a subsequent function call without checking for a null pointer before
(according to a memory allocation failure).
This issue was detected by using the Coccinelle software.
Thus return directly after a failed kasprintf() call.
Fixes: 1b2189f3aa50b ("clk: versatile: clk-icst: Ensure clock names are unique")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/clk/versatile/clk-icst.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index d5cb372f0901..c4cf50a48972 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -537,10 +537,12 @@ static void __init of_syscon_icst_setup(struct device_node *np)
return;
}
- /* Parent clock name is not the same as node parent */
- parent_name = of_clk_get_parent_name(np, 0);
name = kasprintf(GFP_KERNEL, "%pOFP", np);
+ if (!name)
+ return;
+ /* Parent clock name is not the same as node parent */
+ parent_name = of_clk_get_parent_name(np, 0);
regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype);
if (IS_ERR(regclk)) {
pr_err("error setting up syscon ICST clock %s\n", name);
--
2.43.0
next prev parent reply other threads:[~2024-01-17 17:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 17:40 [PATCH 0/2] versatile clock: Adjustments for two function implementations Markus Elfring
2024-01-17 17:41 ` Markus Elfring [this message]
2024-01-17 17:42 ` [PATCH 2/2] clk: versatile: clk-icst: Use common error handling code in icst_clk_setup() Markus Elfring
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=be06e4cf-2e36-4884-bcd0-5d5eb5f191cd@web.de \
--to=markus.elfring@web.de \
--cc=chentao@kylinos.cn \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox