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-next>] [day] [month] [year] [list]
Message-ID: <20250517074341.3841468-1-wozizhi@huawei.com>
Date: Sat, 17 May 2025 15:43:41 +0800
From: Zizhi Wo <wozizhi@...wei.com>
To: <cem@...nel.org>, <djwong@...nel.org>, <dchinner@...hat.com>,
	<osandov@...com>, <john.g.garry@...cle.com>
CC: <linux-xfs@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<wozizhi@...wei.com>, <yangerkun@...wei.com>, <leo.lilong@...wei.com>
Subject: [PATCH] xfs: Remove unnecessary checks in functions related to xfs_fsmap

From: Zizhi Wo <wozizhi@...weicloud.com>

In __xfs_getfsmap_datadev(), if "pag_agno(pag) == end_ag", we don't need
to check the result of query_fn(), because there won't be another iteration
of the loop anyway. Also, both before and after the change, info->group
will eventually be set to NULL and the reference count of xfs_group will
also be decremented before exiting the iteration.

The same logic applies to other similar functions as well, so related
cleanup operations are performed together.

Signed-off-by: Zizhi Wo <wozizhi@...weicloud.com>
Signed-off-by: Zizhi Wo <wozizhi@...wei.com>
---
 fs/xfs/xfs_fsmap.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
index 414b27a86458..792282aa8a29 100644
--- a/fs/xfs/xfs_fsmap.c
+++ b/fs/xfs/xfs_fsmap.c
@@ -579,8 +579,6 @@ __xfs_getfsmap_datadev(
 		if (pag_agno(pag) == end_ag) {
 			info->last = true;
 			error = query_fn(tp, info, &bt_cur, priv);
-			if (error)
-				break;
 		}
 		info->group = NULL;
 	}
@@ -813,8 +811,6 @@ xfs_getfsmap_rtdev_rtbitmap(
 			info->last = true;
 			error = xfs_getfsmap_rtdev_rtbitmap_helper(rtg, tp,
 					&ahigh, info);
-			if (error)
-				break;
 		}
 
 		xfs_rtgroup_unlock(rtg, XFS_RTGLOCK_BITMAP_SHARED);
@@ -1018,8 +1014,6 @@ xfs_getfsmap_rtdev_rmapbt(
 			info->last = true;
 			error = xfs_getfsmap_rtdev_rmapbt_helper(bt_cur,
 					&info->high, info);
-			if (error)
-				break;
 		}
 		info->group = NULL;
 	}
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ