aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 75af3fbe8384..1ba18b72d43a 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -617,27 +617,24 @@ static int ext2_setup_super (struct super_block * sb,
617 return res; 617 return res;
618} 618}
619 619
620static int ext2_check_descriptors (struct super_block * sb) 620static int ext2_check_descriptors(struct super_block *sb)
621{ 621{
622 int i; 622 int i;
623 int desc_block = 0;
624 struct ext2_sb_info *sbi = EXT2_SB(sb); 623 struct ext2_sb_info *sbi = EXT2_SB(sb);
625 unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); 624 unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
626 unsigned long last_block; 625 unsigned long last_block;
627 struct ext2_group_desc * gdp = NULL;
628 626
629 ext2_debug ("Checking group descriptors"); 627 ext2_debug ("Checking group descriptors");
630 628
631 for (i = 0; i < sbi->s_groups_count; i++) 629 for (i = 0; i < sbi->s_groups_count; i++) {
632 { 630 struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL);
631
633 if (i == sbi->s_groups_count - 1) 632 if (i == sbi->s_groups_count - 1)
634 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; 633 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1;
635 else 634 else
636 last_block = first_block + 635 last_block = first_block +
637 (EXT2_BLOCKS_PER_GROUP(sb) - 1); 636 (EXT2_BLOCKS_PER_GROUP(sb) - 1);
638 637
639 if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0)
640 gdp = (struct ext2_group_desc *) sbi->s_group_desc[desc_block++]->b_data;
641 if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || 638 if (le32_to_cpu(gdp->bg_block_bitmap) < first_block ||
642 le32_to_cpu(gdp->bg_block_bitmap) > last_block) 639 le32_to_cpu(gdp->bg_block_bitmap) > last_block)
643 { 640 {
@@ -667,7 +664,6 @@ static int ext2_check_descriptors (struct super_block * sb)
667 return 0; 664 return 0;
668 } 665 }
669 first_block += EXT2_BLOCKS_PER_GROUP(sb); 666 first_block += EXT2_BLOCKS_PER_GROUP(sb);
670 gdp++;
671 } 667 }
672 return 1; 668 return 1;
673} 669}