add patch fix-potential-use-after-free-after-remounting-with-noblock_validity
[ext4-patch-queue.git] / convert-to-host-order-in-ext4_fill_flex_info
blobebe7efb3ee78b6cab4db49391f4a005d78a26f03
1 ext4: Convert to host order before using the values.
3 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
5 Use le16_to_cpu to read the s_reserved_gdt_blocks values
6 from super block.
8 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 ---
11  fs/ext4/super.c |    5 ++---
12  1 files changed, 2 insertions(+), 3 deletions(-)
14 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
15 index 87ac84b..5bfc235 100644
16 --- a/fs/ext4/super.c
17 +++ b/fs/ext4/super.c
18 @@ -1464,9 +1464,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
20         /* We allocate both existing and potentially added groups */
21         flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
22 -                           ((sbi->s_es->s_reserved_gdt_blocks +1 ) <<
23 -                             EXT4_DESC_PER_BLOCK_BITS(sb))) /
24 -                          groups_per_flex;
25 +                       ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
26 +                             EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
27         sbi->s_flex_groups = kzalloc(flex_group_count *
28                                      sizeof(struct flex_groups), GFP_KERNEL);
29         if (sbi->s_flex_groups == NULL) {
30 -- 
31 1.6.0.3.514.g2f91b