[ammarfaizi2-block:dhowells/linux-fs/fscache-fixes 1/4] security/selinux/hooks.c:2772:45: warning: variable 'root_isec' set but not used
From: kernel test robot
Date: Wed Aug 24 2022 - 19:44:04 EST
tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/fscache-fixes
head: 900828ab172a767a0819d99718dcceb778be0d63
commit: de284e31dcfda8ae7b56eaef89efe60be34ecdf9 [1/4] vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing
config: i386-defconfig (https://download.01.org/0day-ci/archive/20220825/202208250749.ugs8aIcf-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/ammarfaizi2/linux-block/commit/de284e31dcfda8ae7b56eaef89efe60be34ecdf9
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/fscache-fixes
git checkout de284e31dcfda8ae7b56eaef89efe60be34ecdf9
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash security/selinux/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
security/selinux/hooks.c: In function 'selinux_fs_context_init':
>> security/selinux/hooks.c:2772:45: warning: variable 'root_isec' set but not used [-Wunused-but-set-variable]
2772 | const struct inode_security_struct *root_isec;
| ^~~~~~~~~
vim +/root_isec +2772 security/selinux/hooks.c
2767
2768 static int selinux_fs_context_init(struct fs_context *fc,
2769 struct dentry *reference)
2770 {
2771 const struct superblock_security_struct *sbsec;
> 2772 const struct inode_security_struct *root_isec;
2773 struct selinux_mnt_opts *opts;
2774
2775 if (fc->purpose == FS_CONTEXT_FOR_SUBMOUNT) {
2776 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
2777 if (!opts)
2778 return -ENOMEM;
2779
2780 root_isec = backing_inode_security(reference->d_sb->s_root);
2781 sbsec = selinux_superblock(reference->d_sb);
2782 if (sbsec->flags & FSCONTEXT_MNT)
2783 opts->fscontext_sid = sbsec->sid;
2784 if (sbsec->flags & CONTEXT_MNT)
2785 opts->context_sid = sbsec->mntpoint_sid;
2786 if (sbsec->flags & DEFCONTEXT_MNT)
2787 opts->defcontext_sid = sbsec->def_sid;
2788 fc->security = opts;
2789 }
2790
2791 return 0;
2792 }
2793
--
0-DAY CI Kernel Test Service
https://01.org/lkp