From: Chengguang Xu <cgxu519@zoho.com.cn>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org, Chengguang Xu <cgxu519@zoho.com.cn>
Subject: [PATCH] ext4: remove some redundant corruption checks
Date: Thu, 23 May 2019 20:48:43 +0800 [thread overview]
Message-ID: <20190523124843.566-1-cgxu519@zoho.com.cn> (raw)
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
next reply other threads:[~2019-05-23 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 12:48 Chengguang Xu [this message]
2019-05-24 4:27 ` [PATCH] ext4: remove some redundant corruption checks Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523124843.566-1-cgxu519@zoho.com.cn \
--to=cgxu519@zoho.com.cn \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).