From: Markus Elfring <Markus.Elfring@web.de>
To: linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org,
Alex Helms <alexander.helms.jy@renesas.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Saeed Nowshadi <saeed.nowshadi@amd.com>,
Kunwu Chan <chentao@kylinos.cn>
Subject: [PATCH] clk: versaclock7: Return directly after a failed kasprintf() call in vc7_probe()
Date: Wed, 17 Jan 2024 16:46:38 +0100 [thread overview]
Message-ID: <75f302b2-9fe0-4b3d-a132-85186c4d9445@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Jan 2024 14:06:13 +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: 48c5e98fedd9e ("clk: Renesas versaclock7 ccf device driver")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/clk/clk-versaclock7.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-versaclock7.c b/drivers/clk/clk-versaclock7.c
index f323263e32c3..96e6b05f2aac 100644
--- a/drivers/clk/clk-versaclock7.c
+++ b/drivers/clk/clk-versaclock7.c
@@ -1127,8 +1127,11 @@ static int vc7_probe(struct i2c_client *client)
node_name = client->dev.of_node->name;
/* Register APLL */
- apll_rate = vc7_get_apll_rate(vc7);
apll_name = kasprintf(GFP_KERNEL, "%s_apll", node_name);
+ if (!apll_name)
+ return -ENOMEM;
+
+ apll_rate = vc7_get_apll_rate(vc7);
vc7->clk_apll.clk = clk_register_fixed_rate(&client->dev, apll_name,
__clk_get_name(vc7->pin_xin),
0, apll_rate);
--
2.43.0
reply other threads:[~2024-01-17 15:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=75f302b2-9fe0-4b3d-a132-85186c4d9445@web.de \
--to=markus.elfring@web.de \
--cc=alexander.helms.jy@renesas.com \
--cc=chentao@kylinos.cn \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=saeed.nowshadi@amd.com \
--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
all inboxes | Powered by JetHome®