f2fs: avoid value overflow in showing current status
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 8 May 2015 23:37:28 +0000 (16:37 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 28 May 2015 22:41:44 +0000 (15:41 -0700)
This patch fixes overflow when do cat /sys/kernel/debug/f2fs/status.
If a section is relatively large, dist value can be overflowed.

Reported-by: Yossi Goldfill <ygoldfill@radianmemory.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/debug.c

index f50acbc5099826ae9bdfc6a5e1419131dcde8176..efbc83f07305097f419a3a415db7480afcb2325b 100644 (file)
@@ -94,7 +94,8 @@ static void update_general_status(struct f2fs_sb_info *sbi)
 static void update_sit_info(struct f2fs_sb_info *sbi)
 {
        struct f2fs_stat_info *si = F2FS_STAT(sbi);
-       unsigned int blks_per_sec, hblks_per_sec, total_vblocks, bimodal, dist;
+       unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
+       unsigned long long bimodal, dist;
        unsigned int segno, vblocks;
        int ndirty = 0;