[viro-vfs:work.statx 1/3] fs/stat.c:770:11: warning: variable 'lflags' set but not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.statx
head:   6bf8aea1847ea450c5bc8de1b7ef194c70e417ff
commit: 8b3d898afb729019f0627a61f34622d115f54581 [1/3] getname_maybe_null() - the third variant of pathname copy-in
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20241010/202410101304.S1BUv98j-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241010/202410101304.S1BUv98j-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410101304.S1BUv98j-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> fs/stat.c:770:11: warning: variable 'lflags' set but not used [-Wunused-but-set-variable]
     770 |         unsigned lflags;
         |                  ^
   1 warning generated.


vim +/lflags +770 fs/stat.c

0ef625bba6fb2b Mateusz Guzik 2024-06-25  751  
a528d35e8bfcc5 David Howells 2017-01-31  752  /**
a528d35e8bfcc5 David Howells 2017-01-31  753   * sys_statx - System call to get enhanced stats
a528d35e8bfcc5 David Howells 2017-01-31  754   * @dfd: Base directory to pathwalk from *or* fd to stat.
0ef625bba6fb2b Mateusz Guzik 2024-06-25  755   * @filename: File to stat or either NULL or "" with AT_EMPTY_PATH
a528d35e8bfcc5 David Howells 2017-01-31  756   * @flags: AT_* flags to control pathwalk.
a528d35e8bfcc5 David Howells 2017-01-31  757   * @mask: Parts of statx struct actually required.
a528d35e8bfcc5 David Howells 2017-01-31  758   * @buffer: Result buffer.
a528d35e8bfcc5 David Howells 2017-01-31  759   *
1e2f82d1e9d122 David Howells 2017-04-26  760   * Note that fstat() can be emulated by setting dfd to the fd of interest,
0ef625bba6fb2b Mateusz Guzik 2024-06-25  761   * supplying "" (or preferably NULL) as the filename and setting AT_EMPTY_PATH
0ef625bba6fb2b Mateusz Guzik 2024-06-25  762   * in the flags.
a528d35e8bfcc5 David Howells 2017-01-31  763   */
a528d35e8bfcc5 David Howells 2017-01-31  764  SYSCALL_DEFINE5(statx,
a528d35e8bfcc5 David Howells 2017-01-31  765  		int, dfd, const char __user *, filename, unsigned, flags,
a528d35e8bfcc5 David Howells 2017-01-31  766  		unsigned int, mask,
a528d35e8bfcc5 David Howells 2017-01-31  767  		struct statx __user *, buffer)
a528d35e8bfcc5 David Howells 2017-01-31  768  {
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  769  	int ret;
0ef625bba6fb2b Mateusz Guzik 2024-06-25 @770  	unsigned lflags;
8b3d898afb7290 Al Viro       2024-10-07  771  	struct filename *name = getname_maybe_null(filename, flags);
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  772  
0ef625bba6fb2b Mateusz Guzik 2024-06-25  773  	/*
0ef625bba6fb2b Mateusz Guzik 2024-06-25  774  	 * Short-circuit handling of NULL and "" paths.
0ef625bba6fb2b Mateusz Guzik 2024-06-25  775  	 *
0ef625bba6fb2b Mateusz Guzik 2024-06-25  776  	 * For a NULL path we require and accept only the AT_EMPTY_PATH flag
0ef625bba6fb2b Mateusz Guzik 2024-06-25  777  	 * (possibly |'d with AT_STATX flags).
0ef625bba6fb2b Mateusz Guzik 2024-06-25  778  	 *
0ef625bba6fb2b Mateusz Guzik 2024-06-25  779  	 * However, glibc on 32-bit architectures implements fstatat as statx
0ef625bba6fb2b Mateusz Guzik 2024-06-25  780  	 * with the "" pathname and AT_NO_AUTOMOUNT | AT_EMPTY_PATH flags.
0ef625bba6fb2b Mateusz Guzik 2024-06-25  781  	 * Supporting this results in the uglification below.
0ef625bba6fb2b Mateusz Guzik 2024-06-25  782  	 */
0ef625bba6fb2b Mateusz Guzik 2024-06-25  783  	lflags = flags & ~(AT_NO_AUTOMOUNT | AT_STATX_SYNC_TYPE);
8b3d898afb7290 Al Viro       2024-10-07  784  	if (!name)
0ef625bba6fb2b Mateusz Guzik 2024-06-25  785  		return do_statx_fd(dfd, flags & ~AT_NO_AUTOMOUNT, mask, buffer);
0ef625bba6fb2b Mateusz Guzik 2024-06-25  786  
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  787  	ret = do_statx(dfd, name, flags, mask, buffer);
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  788  	putname(name);
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  789  
1b6fe6e0dfecf8 Stefan Roesch 2022-02-25  790  	return ret;
a528d35e8bfcc5 David Howells 2017-01-31  791  }
a528d35e8bfcc5 David Howells 2017-01-31  792  

:::::: The code at line 770 was first introduced by commit
:::::: 0ef625bba6fb2bc0c8ed2aab9524fdf423f67dd5 vfs: support statx(..., NULL, AT_EMPTY_PATH, ...)

:::::: TO: Mateusz Guzik <mjguzik@xxxxxxxxx>
:::::: CC: Christian Brauner <brauner@xxxxxxxxxx>

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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux