Re: [PATCH] f2fs: don't allow rename unencrypted file to encrypted directory

From: kbuild test robot
Date: Fri Mar 10 2017 - 17:15:11 EST


Hi Chao,

[auto build test WARNING on f2fs/dev]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Chao-Yu/f2fs-don-t-allow-rename-unencrypted-file-to-encrypted-directory/20170311-052705
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev
config: x86_64-randconfig-n0-03110505 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

In file included from include/linux/linkage.h:4:0,
from include/linux/fs.h:4,
from fs/f2fs/namei.c:11:
fs/f2fs/namei.c: In function 'f2fs_cross_rename':
fs/f2fs/namei.c:858:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^
include/linux/compiler.h:160:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> fs/f2fs/namei.c:858:2: note: in expansion of macro 'if'
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^
fs/f2fs/namei.c:858:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^
include/linux/compiler.h:160:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> fs/f2fs/namei.c:858:2: note: in expansion of macro 'if'
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^
fs/f2fs/namei.c:858:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^
include/linux/compiler.h:171:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^
>> fs/f2fs/namei.c:858:2: note: in expansion of macro 'if'
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
^

vim +/if +858 fs/f2fs/namei.c

842 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
843 struct inode *old_inode = d_inode(old_dentry);
844 struct inode *new_inode = d_inode(new_dentry);
845 struct page *old_dir_page, *new_dir_page;
846 struct page *old_page, *new_page;
847 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL;
848 struct f2fs_dir_entry *old_entry, *new_entry;
849 int old_nlink = 0, new_nlink = 0;
850 int err = -ENOENT;
851
852 if ((f2fs_encrypted_inode(old_dir) &&
853 !fscrypt_has_encryption_key(old_dir)) ||
854 (f2fs_encrypted_inode(new_dir) &&
855 !fscrypt_has_encryption_key(new_dir)))
856 return -ENOKEY;
857
> 858 if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
859 f2fs_encrypted_inode(new_dir) && !f2fs_encrypted_inode(old_inode))
860 return -EPERM;
861
862 if ((f2fs_encrypted_inode(old_dir) || f2fs_encrypted_inode(new_dir)) &&
863 (old_dir != new_dir) &&
864 (!fscrypt_has_permitted_context(new_dir, old_inode) ||
865 !fscrypt_has_permitted_context(old_dir, new_inode)))
866 return -EPERM;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip