ref: bdb50541baac6e536b7201ccf35abe56816bec04
parent: 97134feca27a7b1b13e63c280861940dd7a717de
author: gkostka <[email protected]>
date: Mon Nov 16 20:16:41 EST 2015
Clear ext4_dir_idx_root in ext4_dir_dx_init
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -369,6 +369,8 @@
struct ext4_dir_idx_root *root = (void *)block.data;
struct ext4_dir_idx_root_info *info = &(root->info);
+ memset(root, 0, sizeof(struct ext4_dir_idx_root));
+
/* Initialize dot entries */
ext4_dir_write_entry(&dir->fs->sb,
(struct ext4_dir_entry_ll *)root->dots,
@@ -431,11 +433,8 @@
ext4_dir_entry_ll_set_entry_length(block_entry,
block_size -
sizeof(struct ext4_dir_entry_tail));
- ext4_dir_entry_ll_set_name_length(sb,
- block_entry,
- 0);
- ext4_dir_entry_ll_set_inode_type(sb,
- block_entry,
+ ext4_dir_entry_ll_set_name_length(sb, block_entry, 0);
+ ext4_dir_entry_ll_set_inode_type(sb, block_entry,
EXT4_DIRENTRY_UNKNOWN);
initialize_dir_tail(EXT4_DIRENT_TAIL(block_entry,
@@ -459,8 +458,7 @@
struct ext4_dir_idx_entry *entry = root->entries;
ext4_dir_dx_entry_set_block(entry, iblock);
- ext4_dir_set_dx_checksum(dir,
- (struct ext4_dir_entry_ll *)block.data);
+ ext4_dir_set_dx_checksum(dir, (struct ext4_dir_entry_ll *)block.data);
block.dirty = true;
return ext4_block_set(dir->fs->bdev, &block);