All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [amir73il:sb_write_barrier 19/30] include/linux/fsnotify.h:126:3: warning: variable 'fsnotify_mask' is uninitialized when used here
Date: Fri, 21 Jul 2023 11:18:17 +0800	[thread overview]
Message-ID: <202307211105.zGLTcrGx-lkp@intel.com> (raw)

tree:   https://github.com/amir73il/linux sb_write_barrier
head:   bf9a41c874c7b090a3eb10204ac607fde16fdfb3
commit: 96f25a6844cc4a544a7003caee9e966c6e7f0195 [19/30] fsnotify: introduce pre-content permission event
config: x86_64-randconfig-r011-20230720 (https://download.01.org/0day-ci/archive/20230721/202307211105.zGLTcrGx-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20230721/202307211105.zGLTcrGx-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307211105.zGLTcrGx-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from fs/nfs/unlink.c:12:
   In file included from include/linux/sunrpc/sched.h:19:
   include/linux/sunrpc/xdr.h:778:10: warning: result of comparison of constant 4611686018427387903 with expression of type '__u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           if (len > SIZE_MAX / sizeof(*p))
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/nfs/unlink.c:18:
>> include/linux/fsnotify.h:126:3: warning: variable 'fsnotify_mask' is uninitialized when used here [-Wuninitialized]
                   fsnotify_mask |= FS_PRE_MODIFY;
                   ^~~~~~~~~~~~~
   include/linux/fsnotify.h:110:21: note: initialize the variable 'fsnotify_mask' to silence this warning
           __u32 fsnotify_mask;
                              ^
                               = 0
   2 warnings generated.


vim +/fsnotify_mask +126 include/linux/fsnotify.h

   103	
   104	/*
   105	 * fsnotify_file_perm - permission hook before file access/modify
   106	 */
   107	static inline int fsnotify_file_perm(struct file *file, int mask)
   108	{
   109		struct inode *inode = file_inode(file);
   110		__u32 fsnotify_mask;
   111	
   112		/*
   113		 * Content of file may be written on pre-content events, so sb freeze
   114		 * protection must not be held.
   115		 */
   116		lockdep_assert_once(file_write_not_started(file));
   117	
   118		/*
   119		 * Pre-content events are onlt reported for regular files and dirs.
   120		 */
   121		if (mask & MAY_READ) {
   122			fsnotify_mask = FS_ACCESS_PERM;
   123			if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode))
   124				fsnotify_mask |= FS_PRE_ACCESS;
   125		} else if (mask & MAY_WRITE && S_ISREG(inode->i_mode)) {
 > 126			fsnotify_mask |= FS_PRE_MODIFY;
   127		} else {
   128			return 0;
   129		}
   130	
   131		return fsnotify_file(file, fsnotify_mask);
   132	}
   133	

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

             reply	other threads:[~2023-07-21  3:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  3:18 kernel test robot [this message]
2023-08-11  1:57 [amir73il:sb_write_barrier 19/30] include/linux/fsnotify.h:126:3: warning: variable 'fsnotify_mask' is uninitialized when used here kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202307211105.zGLTcrGx-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=amir73il@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.