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>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20241028-fsl_hypervisor-of_node_put-v1-2-dd0621341fb7@gmail.com>
Date: Mon, 28 Oct 2024 18:05:42 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Arnd Bergmann <arnd@...db.de>, Timur Tabi <timur@...escale.com>, 
 Kumar Gala <galak@...nel.crashing.org>
Cc: linux-kernel@...r.kernel.org, 
 Javier Carrasco <javier.carrasco.cruz@...il.com>
Subject: [PATCH 2/2] virt: fsl: refactor out_of_memory label

The 'out_of_memory' label is only accessible by means of a goto jump
that only happens once. Take the required actions right after the error
happens, and drop the need for a jump out of the loop.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
 drivers/virt/fsl_hypervisor.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 7c7ec13761ba..bc5d7aa246df 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -848,7 +848,13 @@ static int __init fsl_hypervisor_init(void)
 		dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
 		if (!dbisr) {
 			of_node_put(np);
-			goto out_of_memory;
+			list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+				free_irq(dbisr->irq, dbisr);
+				list_del(&dbisr->list);
+				kfree(dbisr);
+			}
+			misc_deregister(&fsl_hv_misc_dev);
+			return -ENOMEM;
 		}
 
 		dbisr->irq = irq;
@@ -895,17 +901,6 @@ static int __init fsl_hypervisor_init(void)
 	}
 
 	return 0;
-
-out_of_memory:
-	list_for_each_entry_safe(dbisr, n, &isr_list, list) {
-		free_irq(dbisr->irq, dbisr);
-		list_del(&dbisr->list);
-		kfree(dbisr);
-	}
-
-	misc_deregister(&fsl_hv_misc_dev);
-
-	return -ENOMEM;
 }
 
 /*

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ