Skip to contentSkip to conversation

security/apparmor/file.c:737:53: warning: variable 'file' is uninitialized when used here

PATCH kernel test robot 1 participant 1 message Oct 29

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next
head:   ce94927fa4173fcc1eca27bdc65a140064c8f1e6
commit: a913281f600157aa036b7c02afbb18a0ac115187 [2/22] apparmor: don't revalidate inherited files under files->file_lock
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20261029/[email protected]/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261029/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> security/apparmor/file.c:737:53: warning: variable 'file' is uninitialized when used here [-Wuninitialized]
     737 |                 int error = aa_file_perm(OP_INHERIT, cred, label, file,
         |                                                                   ^~~~
   security/apparmor/file.c:724:36: note: initialize the variable 'file' to silence this warning
     724 |         struct file *devnull = NULL, *file;
         |                                           ^
         |                                            = NULL

1 warning generated.

vim +/file +737 security/apparmor/file.c

719
720 /* based on selinux's flush_unauthorized_files */
721 void aa_inherit_files(const struct cred *cred, struct files_struct *files)
722 {
723 struct aa_label *label = aa_get_newest_cred_label(cred);
724 struct file *devnull = NULL, *file;
725 bool devnull_tried = false;
726 unsigned int n = 0;
727
728 revalidate_tty(cred, label);
729
730 /*
731 * Revalidate access to inherited open files. Each file is
732 * revalidated holding only a reference to it, with no locks
733 * held, as revalidation may sleep (e.g. unix socket mediation
734 * dropping path refs, or allocating path buffers).
735 */
736 while ((n = iterate_fd(files, n, get_next_file, &file)) != 0) {

 > 737			int error = aa_file_perm(OP_INHERIT, cred, label, file,

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki