lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  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]
Date:   Tue, 5 Dec 2017 00:15:38 +0000
From:   Kazuya Mio <k-mio@...jp.nec.com>
To:     "tytso@....edu" <tytso@....edu>,
        "adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>
CC:     "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Subject: [PATCH] e2freefrag: print 64bit free blocks count

e2freefrag prints incorrect free blocks count when the number of free blocks
is larger than 2^32. 
To fix this problem, e2freefrag uses ext2fs_free_blocks_count(),
not fs->super->s_free_blocks_count.

Signed-off-by: Kazuya Mio <k-mio@...jp.nec.com>
---
 misc/e2freefrag.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
index b315263..c5aeab9 100644
--- a/misc/e2freefrag.c
+++ b/misc/e2freefrag.c
@@ -255,9 +255,10 @@ static errcode_t dump_chunk_info(ext2_filsys fs, struct chunk_info *info,
 	unsigned long start = 0, end;
 	int i, retval = 0;
 
-	fprintf(f, "Total blocks: %llu\nFree blocks: %u (%0.1f%%)\n",
-		ext2fs_blocks_count(fs->super), fs->super->s_free_blocks_count,
-		(double)fs->super->s_free_blocks_count * 100 /
+	fprintf(f, "Total blocks: %llu\nFree blocks: %llu (%0.1f%%)\n",
+		ext2fs_blocks_count(fs->super),
+		ext2fs_free_blocks_count(fs->super),
+		(double)ext2fs_free_blocks_count(fs->super) * 100 /
 		ext2fs_blocks_count(fs->super));
 
 	if (info->chunkbytes) {
@@ -301,7 +302,7 @@ static errcode_t dump_chunk_info(ext2_filsys fs, struct chunk_info *info,
 				info->histogram.fc_chunks[i],
 				info->histogram.fc_blocks[i],
 				(double)info->histogram.fc_blocks[i] * 100 /
-				fs->super->s_free_blocks_count);
+				ext2fs_free_blocks_count(fs->super));
 		}
 		start = end;
 		if (start == 1<<10) {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux - Powered by OpenVZ