lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be06e4cf-2e36-4884-bcd0-5d5eb5f191cd@web.de>
Date: Wed, 17 Jan 2024 18:41:47 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-clk@...r.kernel.org, kernel-janitors@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org,
 Linus Walleij <linus.walleij@...aro.org>,
 Michael Turquette <mturquette@...libre.com>, Rob Herring <robh@...nel.org>,
 Stephen Boyd <sboyd@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH 1/2] clk: versatile: clk-icst: Return directly after a failed
 kasprintf() call in of_syscon_icst_setup()

From: Markus Elfring <elfring@...rs.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@...rs.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ