sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
sb->s_backup_bgs[0] = ext2fs_swab32(sb->s_backup_bgs[0]);
sb->s_backup_bgs[1] = ext2fs_swab32(sb->s_backup_bgs[1]);
+ sb->s_checksum_seed = ext2fs_swab32(sb->s_checksum_seed);
}
void ext2fs_swap_group_desc2(ext2_filsys fs, struct ext2_group_desc *gdp)
to_entry = (struct ext2_ext_attr_entry *)to_header;
}
- while ((char *)from_entry < from_end && *(__u32 *)from_entry) {
+ while ((char *)from_entry < from_end &&
+ (char *)EXT2_EXT_ATTR_NEXT(from_entry) <= from_end &&
+ *(__u32 *)from_entry) {
ext2fs_swap_ext_attr_entry(to_entry, from_entry);
from_entry = EXT2_EXT_ATTR_NEXT(from_entry);
to_entry = EXT2_EXT_ATTR_NEXT(to_entry);
int has_extents = 0;
int has_inline_data = 0;
int islnk = 0;
+ int inode_size;
__u32 *eaf, *eat;
if (hostorder && LINUX_S_ISLNK(f->i_mode))
t->i_flags = ext2fs_swab32(f->i_flags);
if (!hostorder && (t->i_flags & EXT4_EXTENTS_FL))
has_extents = 1;
- if (!hostorder && (f->i_flags & EXT4_INLINE_DATA_FL))
+ if (!hostorder && (t->i_flags & EXT4_INLINE_DATA_FL))
has_inline_data = 1;
- t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
+ t->i_size_high = ext2fs_swab32(f->i_size_high);
/*
* Extent data and inline data are swapped on access, not here
*/
/* this is error case: i_extra_size is too large */
return;
}
+ if (extra_isize & 3)
+ return; /* Illegal inode extra_isize */
- if (extra_isize >= 4)
+ inode_size = EXT2_GOOD_OLD_INODE_SIZE + extra_isize;
+ if (inode_includes(inode_size, i_checksum_hi))
t->i_checksum_hi = ext2fs_swab16(f->i_checksum_hi);
- if (extra_isize >= 8)
+ if (inode_includes(inode_size, i_ctime_extra))
t->i_ctime_extra = ext2fs_swab32(f->i_ctime_extra);
- if (extra_isize >= 12)
+ if (inode_includes(inode_size, i_mtime_extra))
t->i_mtime_extra = ext2fs_swab32(f->i_mtime_extra);
- if (extra_isize >= 16)
+ if (inode_includes(inode_size, i_atime_extra))
t->i_atime_extra = ext2fs_swab32(f->i_atime_extra);
- if (extra_isize >= 20)
+ if (inode_includes(inode_size, i_crtime))
t->i_crtime = ext2fs_swab32(f->i_crtime);
- if (extra_isize >= 24)
+ if (inode_includes(inode_size, i_crtime_extra))
t->i_crtime_extra = ext2fs_swab32(f->i_crtime_extra);
- if (extra_isize >= 28)
+ if (inode_includes(inode_size, i_version_hi))
t->i_version_hi = ext2fs_swab32(f->i_version_hi);
+ if (inode_includes(inode_size, i_projid))
+ t->i_projid = ext2fs_swab16(f->i_projid);
i = sizeof(struct ext2_inode) + extra_isize + sizeof(__u32);
if (bufsize < (int) i)