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: <ebf1570e3d28462a97b1a595794e1969a4c27d81.1729191143.git.waqar.hameed@axis.com>
Date: Thu, 17 Oct 2024 20:41:13 +0200
From: Waqar Hameed <waqar.hameed@...s.com>
To: Richard Weinberger <richard@....at>, Zhihao Cheng
	<chengzhihao1@...wei.com>
CC: <kernel@...s.com>, <linux-mtd@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>
Subject: [PATCH] ubifs: Move update of cnt in get_znodes_to_commit

There is no need to update `cnt` for the first dirty node just before
the loop, and then again update it at the end of each iteration for the
next dirty nodes. Just update `cnt` at the beginning of each iteration
instead. This way, the first iteration will count the first dirty node
and any subsequent iterations will count the next dirty nodes.

Signed-off-by: Waqar Hameed <waqar.hameed@...s.com>
---
 fs/ubifs/tnc_commit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index a55e04822d16..d42f7829389c 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -650,8 +650,8 @@ static int get_znodes_to_commit(struct ubifs_info *c)
 		dbg_cmt("no znodes to commit");
 		return 0;
 	}
-	cnt += 1;
 	while (1) {
+		cnt += 1;
 		ubifs_assert(c, !ubifs_zn_cow(znode));
 		__set_bit(COW_ZNODE, &znode->flags);
 		znode->alt = 0;
@@ -664,7 +664,6 @@ static int get_znodes_to_commit(struct ubifs_info *c)
 		znode->ciip = znode->iip;
 		znode->cnext = cnext;
 		znode = cnext;
-		cnt += 1;
 	}
 	dbg_cmt("committing %d znodes", cnt);
 	ubifs_assert(c, cnt == atomic_long_read(&c->dirty_zn_cnt));
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ