On 32-bit platforms where the file system block size is 8k or greater,
the calculation bpib*bpib*bpib* will overflow a 32-bit calculation,
leading to a divide by zero error. Fix this.
Thanks to Mikulas Patocka for pointing this out.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
if (((i-EXT2_DIRECT-bpib) % (bpib*bpib)) == 0)
last_block++;
if (((i-EXT2_DIRECT-bpib-bpib*bpib) %
- (bpib*bpib*bpib)) == 0)
+ (((__u64) bpib)*bpib*bpib)) == 0)
last_block++;
}
rc = get_bmap(fd, i, &block);