forked from Mirrors/btrfs-progs
btrfs-progs: Avoid uninitialized data in output of btrfs-convert
The sequence, transid and reserved fields of inode were writen to disk with uninitizlized value, this patch fixes it. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>master
parent
537fb08026
commit
f248b10786
|
@ -1016,6 +1016,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst,
|
|||
struct ext2_inode *src, u32 blocksize)
|
||||
{
|
||||
btrfs_set_stack_inode_generation(dst, 1);
|
||||
btrfs_set_stack_inode_sequence(dst, 0);
|
||||
btrfs_set_stack_inode_transid(dst, 1);
|
||||
btrfs_set_stack_inode_size(dst, src->i_size);
|
||||
btrfs_set_stack_inode_nbytes(dst, 0);
|
||||
btrfs_set_stack_inode_block_group(dst, 0);
|
||||
|
@ -1052,6 +1054,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst,
|
|||
new_decode_dev(src->i_block[1]));
|
||||
}
|
||||
}
|
||||
memset(&dst->reserved, 0, sizeof(dst->reserved));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
2
ctree.h
2
ctree.h
|
@ -1424,6 +1424,8 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_generation,
|
|||
struct btrfs_inode_item, generation, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence,
|
||||
struct btrfs_inode_item, sequence, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_transid,
|
||||
struct btrfs_inode_item, transid, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_size,
|
||||
struct btrfs_inode_item, size, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
|
||||
|
|
Loading…
Reference in New Issue