summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-06-06 11:16:43 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-06-06 11:16:43 -0400
commit2f2e09eb15849562aede80ed007658e4504ded26 (patch)
treef8ee7779589ae6b59524b58f053b32bc3cdda211 /fs/ext4
parentb302ef2d3c73d8a07ed2f0679ce35f00b6dcacef (diff)
downloadlinux-2f2e09eb15849562aede80ed007658e4504ded26.tar.bz2
ext4: add sanity check to ext4_get_group_info()
The group number passed to ext4_get_group_info() should be valid, but let's add an assert to check this before we start creating a pointer based on that group number and dereferencing it. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index bd9890f6d9ce..f85f1fb49df8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2313,6 +2313,7 @@ struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
{
struct ext4_group_info ***grp_info;
long indexv, indexh;
+ BUG_ON(group >= EXT4_SB(sb)->s_groups_count);
grp_info = EXT4_SB(sb)->s_group_info;
indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);