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: <95114539-d177-4be7-81bd-a10ef9dd64f2@web.de>
Date: Mon, 23 Sep 2024 18:46:27 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-pci@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Christophe Leroy <christophe.leroy@...roup.eu>,
 Gavin Shan <gwshan@...ux.vnet.ibm.com>, Michael Ellerman
 <mpe@...erman.id.au>, Naveen N Rao <naveen@...nel.org>,
 Nicholas Piggin <npiggin@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH] pci/hotplug/pnv_php: Reduce of_node_put(dn) calls in
 pnv_php_register_slot()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 23 Sep 2024 18:32:21 +0200

An of_node_put(dn) call was immediately used after a pointer check
for a pnv_php_find_slot() call in this function implementation.
Thus call such a function instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/pci/hotplug/pnv_php.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 573a41869c15..fcbf20db136b 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -697,12 +697,9 @@ static int pnv_php_register_slot(struct pnv_php_slot *php_slot)
 		}

 		parent = pnv_php_find_slot(dn);
-		if (parent) {
-			of_node_put(dn);
-			break;
-		}
-
 		of_node_put(dn);
+		if (parent)
+			break;
 	}

 	spin_lock_irqsave(&pnv_php_lock, flags);
--
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ