[amir73il:ovl_copy_file_range 3/6] fs/read_write.c:1499 copy_file_fs_cmp() error: we previously assumed 'f_out->f_op' could be null (see line 1496)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Amir Goldstein <[email protected]>

tree:   https://github.com/amir73il/linux ovl_copy_file_range
head:   4421f88f42bb20b8a6f9fd56c5c877a1088d0e00
commit: b86e287575a3f81b04ef92b5bb46f87329fc314f [3/6] fs: add support for copy file range from another fs
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-141-20260714 (https://download.01.org/0day-ci/archive/20260714/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
fs/read_write.c:1499 copy_file_fs_cmp() error: we previously assumed 'f_out->f_op' could be null (see line 1496)

Old smatch warnings:
fs/read_write.c:1631 vfs_copy_file_range() error: we previously assumed 'file_out->f_op->copy_file_range' could be null (see line 1614)

vim +1499 fs/read_write.c

cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1482  
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1483  /*
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1484   * Check if src and dst file are on the same filesystem.
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1485   * nfs and cifs define several different file_system_type structures
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1486   * and several different sets of file_operations, but they all end up
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1487   * using the same ->copy_file_range() function pointer.
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1488   * COPY_FILE_SPLICE is an opt-in flag for cross-fs copy (e.g. from nfsd),
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1489   * so do not compare src<->dst filesystems in this case.
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1490   */
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1491  static int copy_file_fs_cmp(struct file *f_in, struct file *f_out,
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1492  			    unsigned int flags)
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1493  {
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1494  	if (flags & COPY_FILE_SPLICE)
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1495  		return FS_COPY_SPLICE;
cd6e8d0dbe33ef Amir Goldstein 2026-07-13 @1496  	else if (f_out->f_op && f_out->f_op->copy_file_range &&
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1497  		 f_out->f_op->copy_file_range == f_in->f_op->copy_file_range)
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1498  		return FS_COPY_SAME_FS;
b86e287575a3f8 Amir Goldstein 2026-07-13 @1499  	else if (f_out->f_op->fop_flags & FOP_CROSS_FS_COPY)
b86e287575a3f8 Amir Goldstein 2026-07-13  1500  		return FS_COPY_FROM_OTHER_FS;
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1501  	else if (file_inode(f_in)->i_sb == file_inode(f_out)->i_sb)
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1502  		return FS_COPY_SAME_SB;
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1503  	else
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1504  		return FS_COPY_CROSS_FS;
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1505  }
cd6e8d0dbe33ef Amir Goldstein 2026-07-13  1506  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.