btrfs-progs: convert: Fix inline file extent creation condition
[platform/upstream/btrfs-progs.git] / convert / source-ext2.c
index b1492c7..a2af121 100644 (file)
@@ -310,7 +310,7 @@ static int ext2_create_file_extents(struct btrfs_trans_handle *trans,
        if (ret)
                goto fail;
        if ((convert_flags & CONVERT_FLAG_INLINE_DATA) && data.first_block == 0
-           && data.num_blocks > 0
+           && data.num_blocks > 0 && inode_size < sectorsize
            && inode_size <= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info)) {
                u64 num_bytes = data.num_blocks * sectorsize;
                u64 disk_bytenr = data.disk_block * sectorsize;
@@ -422,8 +422,7 @@ static int ext2_xattr_check_entry(struct ext2_ext_attr_entry *entry,
 {
        size_t value_size = entry->e_value_size;
 
-       if (entry->e_value_block != 0 || value_size > size ||
-           entry->e_value_offs + value_size > size)
+       if (value_size > size || entry->e_value_offs + value_size > size)
                return -EIO;
        return 0;
 }