]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
f2fs: do not unnecessarily null-terminate encrypted symlink data
authorEric Biggers <ebiggers@google.com>
Thu, 22 Sep 2016 20:31:48 +0000 (13:31 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 1 Oct 2016 00:34:28 +0000 (17:34 -0700)
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>
fs/f2fs/namei.c

index bfcd9da9c2eb22ed39168aee106aea7c3f853fc9..300aef8a2d5fe1dacae1b6e3577b158e59141143 100644 (file)
@@ -1015,7 +1015,6 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
        struct fscrypt_str cstr = FSTR_INIT(NULL, 0);
        struct fscrypt_str pstr = FSTR_INIT(NULL, 0);
        struct fscrypt_symlink_data *sd;
-       loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1);
        u32 max_size = inode->i_sb->s_blocksize;
        int res;
 
@@ -1030,7 +1029,6 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
        if (IS_ERR(cpage))
                return ERR_CAST(cpage);
        caddr = page_address(cpage);
-       caddr[size] = 0;
 
        /* Symlink is encrypted */
        sd = (struct fscrypt_symlink_data *)caddr;