summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-08-29 15:41:11 -0400
committerTheodore Ts'o <tytso@mit.edu>2016-08-29 15:41:11 -0400
commit94405713889d4a9d341b4ad92956e4e2ec8ec2c2 (patch)
tree89ff425378c08511273b3e614f41dd14d71ddac3 /fs/ext4
parent1cba423707b47886391c7fcb3614fc67394be06e (diff)
downloadlinux-stable-94405713889d4a9d341b4ad92956e4e2ec8ec2c2.tar.gz
linux-stable-94405713889d4a9d341b4ad92956e4e2ec8ec2c2.tar.bz2
linux-stable-94405713889d4a9d341b4ad92956e4e2ec8ec2c2.zip
ext4: replace bogus assertion in ext4_xattr_shift_entries()
We were checking whether computed offsets do not exceed end of block in ext4_xattr_shift_entries(). However this does not make sense since we always only decrease offsets. So replace that assertion with a check whether we really decrease xattrs value offsets. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/xattr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 1447860b61ec..82b025c977fc 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1319,18 +1319,19 @@ retry:
*/
static void ext4_xattr_shift_entries(struct ext4_xattr_entry *entry,
int value_offs_shift, void *to,
- void *from, size_t n, int blocksize)
+ void *from, size_t n)
{
struct ext4_xattr_entry *last = entry;
int new_offs;
+ /* We always shift xattr headers further thus offsets get lower */
+ BUG_ON(value_offs_shift > 0);
+
/* Adjust the value offsets of the entries */
for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
if (last->e_value_size) {
new_offs = le16_to_cpu(last->e_value_offs) +
value_offs_shift;
- BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
- > blocksize);
last->e_value_offs = cpu_to_le16(new_offs);
}
}
@@ -1542,7 +1543,7 @@ shift:
ext4_xattr_shift_entries(entry, EXT4_I(inode)->i_extra_isize
- new_extra_isize, (void *)raw_inode +
EXT4_GOOD_OLD_INODE_SIZE + new_extra_isize,
- (void *)header, total_ino, inode->i_sb->s_blocksize);
+ (void *)header, total_ino);
EXT4_I(inode)->i_extra_isize = new_extra_isize;
brelse(bh);
out: