aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2016-09-22 13:31:48 -0700
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:34:10 +0200
commit4229c988057ee5980c28d8fd9d7f85c6c1096cc7 (patch)
tree3f4fc1f66e29403a47dc8f1fe6cc04e91815cfce
parent032f451ddd6f802762914a71a0da884a7cf336bc (diff)
f2fs: do not unnecessarily null-terminate encrypted symlink data
Null-terminating the fscrypt_symlink_data on read is unnecessary because it is not string data --- it contains binary ciphertext. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/namei.c
-rw-r--r--fs/f2fs/namei.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index c4346d0af..47048a1ed 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -756,7 +756,6 @@ static void *f2fs_encrypted_follow_link(struct dentry *dentry,
struct fscrypt_str pstr = FSTR_INIT(NULL, 0);
struct fscrypt_symlink_data *sd;
struct inode *inode = d_inode(dentry);
- loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1);
u32 max_size = inode->i_sb->s_blocksize;
int res;
@@ -766,9 +765,8 @@ static void *f2fs_encrypted_follow_link(struct dentry *dentry,
cpage = read_mapping_page(inode->i_mapping, 0, NULL);
if (IS_ERR(cpage))
- return cpage;
+ return ERR_CAST(cpage);
caddr = kmap(cpage);
- caddr[size] = 0;
/* Symlink is encrypted */
sd = (struct fscrypt_symlink_data *)caddr;