From 751efa803bde8b8f150d97e3208a1ce15a9da0bc Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 2 Mar 2018 16:59:20 -0800 Subject: [PATCH] e2fsck: drop redundant checks of symlink i_size 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 Signed-off-by: Theodore Ts'o --- e2fsck/pass1.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 6a6c596..3a49e02 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; -- 1.8.3.1