Remove some redundant corruption checks in ext4_xattr_block_get() and ext4_xattr_ibody_get() because ext4_xattr_check_entries() has done those checks. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxx> --- fs/ext4/xattr.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 491f9ee4040e..b74346f103a6 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -542,8 +542,6 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name, goto cleanup; size = le32_to_cpu(entry->e_value_size); error = -ERANGE; - if (unlikely(size > EXT4_XATTR_SIZE_MAX)) - goto cleanup; if (buffer) { if (size > buffer_size) goto cleanup; @@ -556,8 +554,6 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name, u16 offset = le16_to_cpu(entry->e_value_offs); void *p = bh->b_data + offset; - if (unlikely(p + size > end)) - goto cleanup; memcpy(buffer, p, size); } } @@ -597,8 +593,6 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, goto cleanup; size = le32_to_cpu(entry->e_value_size); error = -ERANGE; - if (unlikely(size > EXT4_XATTR_SIZE_MAX)) - goto cleanup; if (buffer) { if (size > buffer_size) goto cleanup; @@ -611,8 +605,6 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, u16 offset = le16_to_cpu(entry->e_value_offs); void *p = (void *)IFIRST(header) + offset; - if (unlikely(p + size > end)) - goto cleanup; memcpy(buffer, p, size); } } -- 2.17.2