Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ecryptfs: combine the two ATTR_SIZE blocks in ecryptfs_setattr

Simplify the logic in ecryptfs_setattr by combining the two ATTR_SIZE
blocks. This initializes lower_ia before the size check, which is
obviously correct as the size check doesn't look at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tyler Hicks <code@tyhicks.com>

authored by

Christoph Hellwig and committed by
Tyler Hicks
472dea1d b19fe74e

+4 -5
+4 -5
fs/ecryptfs/inode.c
··· 934 934 rc = setattr_prepare(&nop_mnt_idmap, dentry, ia); 935 935 if (rc) 936 936 goto out; 937 - if (ia->ia_valid & ATTR_SIZE) { 938 - rc = ecryptfs_inode_newsize_ok(inode, ia->ia_size); 939 - if (rc) 940 - goto out; 941 - } 942 937 943 938 memcpy(&lower_ia, ia, sizeof(lower_ia)); 944 939 if (ia->ia_valid & ATTR_FILE) 945 940 lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); 946 941 if (ia->ia_valid & ATTR_SIZE) { 942 + rc = ecryptfs_inode_newsize_ok(inode, ia->ia_size); 943 + if (rc) 944 + goto out; 945 + 947 946 rc = truncate_upper(dentry, ia, &lower_ia); 948 947 if (rc < 0) 949 948 goto out;