An integer overflow could happen if the file system is large and has
very large contiguous chunks of free space.
Addresses-Debian-Bug: #718205
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
/* Display chunk information in KB */
if (info->real_free_chunks) {
- info->min = (info->min * fs->blocksize) >> 10;
- info->max = (info->max * fs->blocksize) >> 10;
- info->avg = (info->avg / info->real_free_chunks *
- fs->blocksize) >> 10;
+ unsigned int scale = fs->blocksize >> 10;
+ info->min = info->min * scale;
+ info->max = info->max * scale;
+ info->avg = info->avg / info->real_free_chunks * scale;
} else {
info->min = 0;
}