[brauner-vfs:work.f_version 10/25] fs/read_write.c:101: warning: Function parameter or struct member 'file' not described in 'must_set_pos'

From: kernel test robot <hidden>
Date: 2024-08-31 06:32:51
Also in: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git work.f_version
head:   d72dc08ce60a47a989d21ef59e54f19875a02bc0
commit: cceaab97d92605d32034f3451e1cfec1cc80299a [10/25] fs: add must_set_pos()
config: s390-allnoconfig (https://download.01.org/0day-ci/archive/20240831/202408311424.c7gx0m7d-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 46fe36a4295f05d5d3731762e31fc4e6e99863e9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240831/202408311424.c7gx0m7d-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 [off-list ref]
| Closes: https://lore.kernel.org/oe-kbuild-all/202408311424.c7gx0m7d-lkp@intel.com/ (local)

All warnings (new ones prefixed by >>):
quoted
fs/read_write.c:101: warning: Function parameter or struct member 'file' not described in 'must_set_pos'

vim +101 fs/read_write.c

    87	
    88	/**
    89	 * must_set_pos - check whether f_pos has to be updated
    90	 * @offset: offset to use
    91	 * @whence: type of seek operation
    92	 * @eof: end of file
    93	 *
    94	 * Check whether f_pos needs to be updated and update @offset according
    95	 * to @whence.
    96	 *
    97	 * Return: 0 if f_pos doesn't need to be updated, 1 if f_pos has to be
    98	 * updated, and negative error code on failure.
    99	 */
   100	static __maybe_unused int must_set_pos(struct file *file, loff_t *offset, int whence, loff_t eof)
 > 101	{
   102		switch (whence) {
   103		case SEEK_END:
   104			*offset += eof;
   105			break;
   106		case SEEK_CUR:
   107			/*
   108			 * Here we special-case the lseek(fd, 0, SEEK_CUR)
   109			 * position-querying operation.  Avoid rewriting the "same"
   110			 * f_pos value back to the file because a concurrent read(),
   111			 * write() or lseek() might have altered it
   112			 */
   113			if (*offset == 0) {
   114				*offset = file->f_pos;
   115				return 0;
   116			}
   117			break;
   118		case SEEK_DATA:
   119			/*
   120			 * In the generic case the entire file is data, so as long as
   121			 * offset isn't at the end of the file then the offset is data.
   122			 */
   123			if ((unsigned long long)*offset >= eof)
   124				return -ENXIO;
   125			break;
   126		case SEEK_HOLE:
   127			/*
   128			 * There is a virtual hole at the end of the file, so as long as
   129			 * offset isn't i_size or larger, return i_size.
   130			 */
   131			if ((unsigned long long)*offset >= eof)
   132				return -ENXIO;
   133			*offset = eof;
   134			break;
   135		}
   136	
   137		return 1;
   138	}
   139	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help