shithub: lwext4

Download patch

ref: 16b7ebbb8f420dceb77baa18918ea5c7af0a156e
parent: 8be3eaa05aa4b952a6a788da2092d6c99bada5ef
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sun Nov 15 12:24:41 EST 2015

ext4_mkfs: use EXT4_SUPERBLOCK_SIZE instead of sizeof op.

--- a/lwext4/ext4_mkfs.c
+++ b/lwext4/ext4_mkfs.c
@@ -180,7 +180,7 @@
 		aux_info->len_blocks -= last_group_size;
 	}
 
-	aux_info->sb = calloc(1, sizeof(struct ext4_sblock));
+	aux_info->sb = calloc(1, EXT4_SUPERBLOCK_SIZE);
 	if (!aux_info->sb)
 		return ENOMEM;
 
@@ -318,7 +318,7 @@
 
 			aux_info->sb->block_group_index = i;
 			r = ext4_block_writebytes(bd, offset, aux_info->sb,
-						  sizeof(struct ext4_sblock));
+						  EXT4_SUPERBLOCK_SIZE);
 			if (r != EOK)
 				return r;
 		}
@@ -327,7 +327,7 @@
 	/* write out the primary superblock */
 	aux_info->sb->block_group_index = 0;
 	return ext4_block_writebytes(bd, 1024, aux_info->sb,
-				     sizeof(struct ext4_sblock));
+				     EXT4_SUPERBLOCK_SIZE);
 }
 
 
@@ -339,7 +339,7 @@
 	if (r != EOK)
 		return r;
 
-	sb = malloc(sizeof(struct ext4_sblock));
+	sb = malloc(EXT4_SUPERBLOCK_SIZE);
 	if (!sb)
 		goto Finish;