[PATCH 07/10] e2fsck: drop redundant checks of symlink i_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eric Biggers <ebiggers@xxxxxxxxxx>

e2fsck_pass1_check_symlink() verifies that the symlink inode's i_size is
less than the buffer length (60 for fast symlinks, fs->blocksize for
slow symlinks).  But it also verifies that len == i_size &&
len < buflen, which already implies i_size < buflen.  Thus, remove the
redundant checks of i_size.

Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
 e2fsck/pass1.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 6a6c5969..3a49e020 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -230,14 +230,10 @@ int e2fsck_pass1_check_symlink(ext2_filsys fs, ext2_ino_t ino,
 	}
 
 	if (ext2fs_is_fast_symlink(inode)) {
-		if (inode->i_size >= sizeof(inode->i_block))
-			return 0;
-
 		buf = (char *)inode->i_block;
 		buflen = sizeof(inode->i_block);
 	} else {
-		if ((inode->i_size >= fs->blocksize) ||
-		    (inode->i_block[0] < fs->super->s_first_data_block) ||
+		if ((inode->i_block[0] < fs->super->s_first_data_block) ||
 		    (inode->i_block[0] >= ext2fs_blocks_count(fs->super)))
 			return 0;
 
-- 
2.16.2.395.g2e18187dfd-goog




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux