ext4: Use vzalloc in ext4_fill_flex_info()
authorJoe Perches <joe@perches.com>
Mon, 20 Dec 2010 03:21:02 +0000 (22:21 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 20 Dec 2010 03:21:02 +0000 (22:21 -0500)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c

index 072ff973ff2b6658ef96f13f3866b852a526d3f7..10290f8f5922a53ca45e44cc84e0dd9ccdc9d587 100644 (file)
@@ -1930,14 +1930,13 @@ static int ext4_fill_flex_info(struct super_block *sb)
        size = flex_group_count * sizeof(struct flex_groups);
        sbi->s_flex_groups = kzalloc(size, GFP_KERNEL);
        if (sbi->s_flex_groups == NULL) {
-               sbi->s_flex_groups = vmalloc(size);
-               if (sbi->s_flex_groups)
-                       memset(sbi->s_flex_groups, 0, size);
-       }
-       if (sbi->s_flex_groups == NULL) {
-               ext4_msg(sb, KERN_ERR, "not enough memory for "
-                               "%u flex groups", flex_group_count);
-               goto failed;
+               sbi->s_flex_groups = vzalloc(size);
+               if (sbi->s_flex_groups == NULL) {
+                       ext4_msg(sb, KERN_ERR,
+                                "not enough memory for %u flex groups",
+                                flex_group_count);
+                       goto failed;
+               }
        }
 
        for (i = 0; i < sbi->s_groups_count; i++) {