From: kernel test robot <lkp@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
linux-fsdevel@vger.kernel.org
Subject: [viro-vfs:work.statx 1/3] fs/stat.c:770:11: warning: variable 'lflags' set but not used
Date: Thu, 10 Oct 2024 13:49:55 +0800 [thread overview]
Message-ID: <202410101304.S1BUv98j-lkp@intel.com> (raw)
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@intel.com/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@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/202410101304.S1BUv98j-lkp@intel.com/
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@gmail.com>
:::::: CC: Christian Brauner <brauner@kernel.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-10-10 5:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202410101304.S1BUv98j-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).