linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: remove some redundant corruption checks
@ 2019-05-23 12:48 Chengguang Xu
  2019-05-24  4:27 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2019-05-23 12:48 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, Chengguang Xu

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@zoho.com.cn>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-24  4:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-23 12:48 [PATCH] ext4: remove some redundant corruption checks Chengguang Xu
2019-05-24  4:27 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).