Re: [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)
Amir Goldstein <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild,dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <CAOQ4uxjEgOH1H+YMs2y9Fe4Ri6q=yrr8FqKX1BH9DjeVwvWWag@mail.gmail.com> |
On Tue, Jul 14, 2026 at 9:16 AM Dan Carpenter <[email protected]> wrote: > > 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 > 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) I think this assumption was wrong and the extra f_out->f_op test can be avoided here > > 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 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 && > ^^^^^^^^^^^ > if ->f_op is NULL > > 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) > ^^^^^^^^^^^^^^^^^^^^^^ > then we are toasted. > > 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 } > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki >