X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=fs%2Fext4%2Fsuper.c;h=422ed7946c20ea10f4ce281e2e268707137ac92b;hp=3fc028df968c81fde47789fc642ac1bdd4ec6233;hb=cbcef10ae6060412e8f2cad26ed9468bc472733a;hpb=14f48cfd0bac66d471104d739595fc3c6d0ffc78 diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3fc028df968c..422ed7946c20 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3180,10 +3180,15 @@ static int count_overhead(struct super_block *sb, ext4_group_t grp, ext4_set_bit(s++, buf); count++; } - for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) { - ext4_set_bit(EXT4_B2C(sbi, s++), buf); - count++; + j = ext4_bg_num_gdb(sb, grp); + if (s + j > EXT4_BLOCKS_PER_GROUP(sb)) { + ext4_error(sb, "Invalid number of block group " + "descriptor blocks: %d", j); + j = EXT4_BLOCKS_PER_GROUP(sb) - s; } + count += j; + for (; j > 0; j--) + ext4_set_bit(EXT4_B2C(sbi, s++), buf); } if (!count) return 0;