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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250613073733.3642679-2-tan.shaopeng@jp.fujitsu.com>
Date: Fri, 13 Jun 2025 16:37:31 +0900
From: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
To: x86@...nel.org,
	linux-kernel@...r.kernel.org
Cc: Reinette Chatre <reinette.chatre@...el.com>,
	James Morse <james.morse@....com>,
	Yury Norov <yury.norov@...il.com>,
	Dave Martin <dave.martin@....com>,
	fenghuay@...dia.com,
	peternewman@...gle.com,
	Babu Moger <Babu.Moger@....com>,
	Borislav Petkov <bp@...en8.de>,
	shameerali.kolothum.thodi@...wei.com,
	bobo.shaobowang@...wei.com,
	D Scott Phillips OS <scott@...amperecomputing.com>,
	carl@...amperecomputing.com,
	Koba Ko <kobak@...dia.com>,
	Shanker Donthineni <sdonthineni@...dia.com>,
	Xin Hao <xhao@...ux.alibaba.com>,
	baolin.wang@...ux.alibaba.com,
	lcherian@...vell.com,
	amitsinght@...vell.com,
	Ingo Molnar <mingo@...hat.com>,
	David Hildenbrand <david@...hat.com>,
	H Peter Anvin <hpa@...or.com>,
	Rex Nie <rex.nie@...uarmicro.com>,
	Jamie Iles <quic_jiles@...cinc.com>,
	dfustini@...libre.com,
	Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH] fs/resctrl: Optimize code in rdt_get_tree()

schemata_list_destroy() has to be called if schemata_list_create() fails.

rdt_get_tree() calls schemata_list_destroy() in two different ways: 
directly if schemata_list_create() itself fails and 
on the exit path via the out_schemata_free goto label.

Remove schemata_list_destroy() call on schemata_list_create() failure.
Use existing out_schemata_free goto label instead.

Signed-off-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
---
 fs/resctrl/rdtgroup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 1beb124e25f6..592d4f69fce9 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2608,10 +2608,8 @@ static int rdt_get_tree(struct fs_context *fc)
 		goto out_root;
 
 	ret = schemata_list_create();
-	if (ret) {
-		schemata_list_destroy();
-		goto out_ctx;
-	}
+	if (ret)
+		goto out_schemata_free;
 
 	ret = closid_init();
 	if (ret)
@@ -2683,7 +2681,6 @@ static int rdt_get_tree(struct fs_context *fc)
 	closid_exit();
 out_schemata_free:
 	schemata_list_destroy();
-out_ctx:
 	rdt_disable_ctx();
 out_root:
 	rdtgroup_destroy_root();
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ