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>] [day] [month] [year] [list]
Message-ID: <89708781-f34a-47af-8aab-025136507da0@web.de>
Date: Sun, 24 Dec 2023 09:52:21 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-clk@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
 linux-arm-kernel@...ts.infradead.org, kernel-janitors@...r.kernel.org,
 Alexandre Torgue <alexandre.torgue@...s.st.com>,
 Maxime Coquelin <mcoquelin.stm32@...il.com>,
 Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH] clk: stm32f4: One function call less in stm32f4_rcc_init()
 after error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 24 Dec 2023 09:40:10 +0100

The kfree() function was called in one case by the
stm32f4_rcc_init() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus use another label.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/clk/clk-stm32f4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 07c13ebe327d..c7690a1594eb 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -1714,7 +1714,7 @@ static void __init stm32f4_rcc_init(struct device_node *np)
 	clks = kmalloc_array(data->gates_num + stm32fx_end_primary_clk,
 			sizeof(*clks), GFP_KERNEL);
 	if (!clks)
-		goto fail;
+		goto unmap_io;

 	stm32f4_gate_map = data->gates_map;

@@ -1897,6 +1897,7 @@ static void __init stm32f4_rcc_init(struct device_node *np)
 	return;
 fail:
 	kfree(clks);
+unmap_io:
 	iounmap(base);
 }
 CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init);
--
2.43.0


Powered by blists - more mailing lists