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]
Message-ID: <b7e69e04-e15c-41ec-b62b-37253debc654@web.de>
Date: Wed, 2 Oct 2024 22:02:20 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linuxppc-dev@...ts.ozlabs.org,
 Christophe Leroy <christophe.leroy@...roup.eu>,
 Jani Nikula <jani.nikula@...el.com>,
 Madhavan Srinivasan <maddy@...ux.ibm.com>,
 Michael Ellerman <mpe@...erman.id.au>, Naveen N Rao <naveen@...nel.org>,
 Nicholas Piggin <npiggin@...il.com>, Paul Mackerras <paulus@...ba.org>,
 Stephen Rothwell <sfr@...b.auug.org.au>,
 Thomas Zimmermann <tzimmermann@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH] powermac: Call of_node_put(bk_node) only once in
 pmac_has_backlight_type()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 2 Oct 2024 21:50:27 +0200

An of_node_put(bk_node) call was immediately used after a pointer check
for an of_get_property() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/powerpc/platforms/powermac/backlight.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index 12bc01353bd3..d3666595a62e 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -61,11 +61,9 @@ int pmac_has_backlight_type(const char *type)
 	if (bk_node) {
 		const char *prop = of_get_property(bk_node,
 				"backlight-control", NULL);
-		if (prop && strncmp(prop, type, strlen(type)) == 0) {
-			of_node_put(bk_node);
-			return 1;
-		}
 		of_node_put(bk_node);
+		if (prop && strncmp(prop, type, strlen(type)) == 0)
+			return 1;
 	}

 	return 0;
--
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ