2023-05-09 14:02:07

by kernel test robot

[permalink] [raw]
Subject: fs/splice.c:53:19: sparse: sparse: cast from restricted fmode_t

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ba0ad6ed89fd5dada3b7b65ef2b08e95d449d4ab
commit: 0f99fc513ddd28de155c58547824a9fd63daacea splice: clear FMODE_NOWAIT on file if splice/vmsplice is used
date: 2 weeks ago
config: loongarch-randconfig-s052-20230507 (https://download.01.org/0day-ci/archive/20230509/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f99fc513ddd28de155c58547824a9fd63daacea
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0f99fc513ddd28de155c58547824a9fd63daacea
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> fs/splice.c:53:19: sparse: sparse: cast from restricted fmode_t
>> fs/splice.c:53:19: sparse: sparse: cast from restricted fmode_t
>> fs/splice.c:53:19: sparse: sparse: cast to restricted fmode_t

vim +53 fs/splice.c

39
40 /*
41 * Splice doesn't support FMODE_NOWAIT. Since pipes may set this flag to
42 * indicate they support non-blocking reads or writes, we must clear it
43 * here if set to avoid blocking other users of this pipe if splice is
44 * being done on it.
45 */
46 static noinline void noinline pipe_clear_nowait(struct file *file)
47 {
48 fmode_t fmode = READ_ONCE(file->f_mode);
49
50 do {
51 if (!(fmode & FMODE_NOWAIT))
52 break;
> 53 } while (!try_cmpxchg(&file->f_mode, &fmode, fmode & ~FMODE_NOWAIT));
54 }
55

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