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: <20240618135845.13387-1-david.hunter.linux@gmail.com>
Date: Tue, 18 Jun 2024 09:58:45 -0400
From: David Hunter <david.hunter.linux@...il.com>
To: perex@...ex.cz,
	tiwai@...e.com,
	lgirdwood@...il.com,
	broonie@...nel.org
Cc: David Hunter <david.hunter.linux@...il.com>,
	linux-sound@...r.kernel.org,
	julia.lawall@...ia.fr,
	skhan@...uxfoundation.org,
	javier.carrasco.cruz@...il.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH] sound:rk817 reduce memmory leak chance with __free

Using the __free function instead of of_node_put helps with
preventing memory leaks.

The kernel was cross-compiled and installed on an arm64 system.

Unable to test if the sound system still worked because I was on an
Arm64 virtual machine, and I could not get the sound to work on
the machine.

I could not find unit tests or kselftests that utilize code in
rk817_codec.c. If there are any tests that I should run, please
let me know.

Signed-off-by: David Hunter <david.hunter.linux@...il.com>
---
 sound/soc/codecs/rk817_codec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
index d4da98469f8b..1ad576cd7ea2 100644
--- a/sound/soc/codecs/rk817_codec.c
+++ b/sound/soc/codecs/rk817_codec.c
@@ -456,9 +456,9 @@ static const struct snd_soc_component_driver soc_codec_dev_rk817 = {
 static void rk817_codec_parse_dt_property(struct device *dev,
 					 struct rk817_codec_priv *rk817)
 {
-	struct device_node *node;
+	struct device_node *node __free(device_node) = of_get_child_by_name(dev->parent->of_node,
+									    "codec");
 
-	node = of_get_child_by_name(dev->parent->of_node, "codec");
 	if (!node) {
 		dev_dbg(dev, "%s() Can not get child: codec\n",
 			__func__);
@@ -466,8 +466,6 @@ static void rk817_codec_parse_dt_property(struct device *dev,
 
 	rk817->mic_in_differential =
 			of_property_read_bool(node, "rockchip,mic-in-differential");
-
-	of_node_put(node);
 }
 
 static int rk817_platform_probe(struct platform_device *pdev)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ