summaryrefslogtreecommitdiff
path: root/e2fsck/super.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-01-03 13:42:38 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-01-05 10:14:11 -0500
commit027b0577d4e5081a4d28dff9289559d38a36d533 (patch)
treedf65e7fb7c9e45d11c23d00396e90a0e07c414b6 /e2fsck/super.c
parenta0ba54ec00abce6ce9e7e5f2d5f6e0899559ebb8 (diff)
downloade2fsprogs-027b0577d4e5081a4d28dff9289559d38a36d533.tar.gz
Fix 32-bit overflow problems: dgrp_t * s_blocks_per_group
There are a number of places where we multiply a dgrp_t with s_blocks_per_group expecting that we will get a blk64_t. This requires a cast, or using the convenience function ext2fs_group_first_block2(). This audit was suggested by Eric Sandeen. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'e2fsck/super.c')
-rw-r--r--e2fsck/super.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 160991d6..b9870f73 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -317,7 +317,8 @@ void check_resize_inode(e2fsck_t ctx)
struct problem_context pctx;
int i, gdt_off, ind_off;
dgrp_t j;
- blk64_t blk, pblk, expect;
+ blk64_t blk, pblk;
+ blk_t expect; /* for resize inode, which is 32-bit only */
__u32 *dind_buf = 0, *ind_buf;
errcode_t retval;
@@ -914,8 +915,7 @@ int check_backup_super_block(e2fsck_t ctx)
if (!ext2fs_bg_has_super(fs, g))
continue;
- sb = fs->super->s_first_data_block +
- (g * fs->super->s_blocks_per_group);
+ sb = ext2fs_group_first_block2(fs, g);
retval = io_channel_read_blk(fs->io, sb, -SUPERBLOCK_SIZE,
buf);