mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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>
This commit is contained in:
parent
b302ef2d3c
commit
2f2e09eb15
@ -2313,6 +2313,7 @@ struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
|
|||||||
{
|
{
|
||||||
struct ext4_group_info ***grp_info;
|
struct ext4_group_info ***grp_info;
|
||||||
long indexv, indexh;
|
long indexv, indexh;
|
||||||
|
BUG_ON(group >= EXT4_SB(sb)->s_groups_count);
|
||||||
grp_info = EXT4_SB(sb)->s_group_info;
|
grp_info = EXT4_SB(sb)->s_group_info;
|
||||||
indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
|
indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
|
||||||
indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
|
indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user