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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20110414011037.GI11970@MAIL.13thfloor.at>
Date:	Thu, 14 Apr 2011 03:10:37 +0200
From:	Herbert Poetzl <herbert@...hfloor.at>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] genhd: remove useless cast in diskstats_show()


This patch removes the (unsigned long long) cast in
diskstats_show() and adjusts the seq_printf() format
string to 'unsigned long'

diskstats_show() uses part_stat_read() to get the
stats, which either accesses the specified field in
the struct disk_stats directly (non SMP) or sums
up the per CPU values in a variable of the same
type as the field, so in any case the result will
have the same type and range as the specified field
which for all disk_stats entries is unsigned long

also, for unsigned long ranges the output of %lu
should be identical to the one of %llu, so no cange
in teh actual proc entry contents

best,
Herbert

Signed-off-by: Herbert Poetzl <herbert@...hfloor.at>
---
--- linux/block/genhd.c	2011-03-07 16:53:26.000000000 +0100
+++ linux/block/genhd.c	2011-04-14 03:36:35.000000000 +0200
@@ -1154,17 +1154,17 @@ static int diskstats_show(struct seq_fil
 		cpu = part_stat_lock();
 		part_round_stats(cpu, hd);
 		part_stat_unlock();
-		seq_printf(seqf, "%4d %7d %s %lu %lu %llu "
-			   "%u %lu %lu %llu %u %u %u %u\n",
+		seq_printf(seqf, "%4d %7d %s %lu %lu %lu "
+			   "%u %lu %lu %lu %u %u %u %u\n",
 			   MAJOR(part_devt(hd)), MINOR(part_devt(hd)),
 			   disk_name(gp, hd->partno, buf),
 			   part_stat_read(hd, ios[0]),
 			   part_stat_read(hd, merges[0]),
-			   (unsigned long long)part_stat_read(hd, sectors[0]),
+			   part_stat_read(hd, sectors[0]),
 			   jiffies_to_msecs(part_stat_read(hd, ticks[0])),
 			   part_stat_read(hd, ios[1]),
 			   part_stat_read(hd, merges[1]),
-			   (unsigned long long)part_stat_read(hd, sectors[1]),
+			   part_stat_read(hd, sectors[1]),
 			   jiffies_to_msecs(part_stat_read(hd, ticks[1])),
 			   part_in_flight(hd),
 			   jiffies_to_msecs(part_stat_read(hd, io_ticks)),
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ