From: Theodore Ts'o Date: Sat, 28 Nov 2009 15:28:03 +0000 (-0500) Subject: filefrag: Fix a core dump on sparc32 platforms with 8k file systems X-Git-Tag: v1.41.10~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca92d98f0afa6e79dff672923b96cbc2274449be;p=thirdparty%2Fe2fsprogs.git filefrag: Fix a core dump on sparc32 platforms with 8k file systems 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" --- diff --git a/misc/filefrag.c b/misc/filefrag.c index 11783fdcd..1611f90d8 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -341,7 +341,7 @@ static void frag_report(const char *filename) 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);