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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 28 Apr 2024 17:22:27 +0530
From: Shresth Prasad <shresthprasad7@...il.com>
To: robh@...nel.org,
	saravanak@...gle.com
Cc: devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	javier.carrasco.cruz@...il.com,
	skhan@...uxfoundation.org,
	Shresth Prasad <shresthprasad7@...il.com>,
	Julia Lawall <julia.lawall@...ia.fr>
Subject: [PATCH][next] of: property: Use scope based cleanup on port_node

Use __free cleanup handler which ensures that the resource is freed when
it goes out of scope, thus removing the need to manually clean it up
using of_node_put.

Suggested-by: Julia Lawall <julia.lawall@...ia.fr>
Signed-off-by: Shresth Prasad <shresthprasad7@...il.com>
---
Rob Herring <robh@...nel.org> sent a patch fixing similar cases in
property.c but seems to have missed this one. Please let me know if this
is mistake, or if it was left unchanged for a reason.

 drivers/of/property.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 6d5ae58a7ac9..abc8613b471f 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -576,7 +576,8 @@ EXPORT_SYMBOL_GPL(of_prop_next_string);
 int of_graph_parse_endpoint(const struct device_node *node,
 			    struct of_endpoint *endpoint)
 {
-	struct device_node *port_node = of_get_parent(node);
+	struct device_node *port_node __free(device_node) =
+			    of_get_parent(node);
 
 	WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n",
 		  __func__, node);
@@ -591,8 +592,6 @@ int of_graph_parse_endpoint(const struct device_node *node,
 	of_property_read_u32(port_node, "reg", &endpoint->port);
 	of_property_read_u32(node, "reg", &endpoint->id);
 
-	of_node_put(port_node);
-
 	return 0;
 }
 EXPORT_SYMBOL(of_graph_parse_endpoint);
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ