From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [bcachefs:bcachefs-testing 11/42] fs/bcachefs/vfs/ioctl.c:914:66-67: WARNING opportunity for min()
Date: Tue, 07 Apr 2026 11:57:59 +0800 [thread overview]
Message-ID: <202604050900.7W0I00dm-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Kent Overstreet <kent.overstreet@linux.dev>
TO: Kent Overstreet <kent.overstreet@linux.dev>
tree: https://evilpiepirate.org/git/bcachefs.git bcachefs-testing
head: a33008fc8f2cf78de0ed73dc9b1dc6a46d278287
commit: 39fe245ff806f1dcf1d02b034d35df86b8944ec2 [11/42] bcachefs: wire up error reporting in pread_raw ioctl
:::::: branch date: 2 hours ago
:::::: commit date: 11 days ago
config: um-randconfig-r051-20260405 (https://download.01.org/0day-ci/archive/20260405/202604050900.7W0I00dm-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202604050900.7W0I00dm-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/bcachefs/vfs/ioctl.c:914:66-67: WARNING opportunity for min()
vim +914 fs/bcachefs/vfs/ioctl.c
d4bd02beae9ffc Kent Overstreet 2026-02-10 868
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 869 static long bch2_ioc_pread_raw(struct file *file,
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 870 struct bch_inode_info *inode,
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 871 struct bch_ioctl_pread_raw __user *uarg)
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 872 {
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 873 struct bch_ioctl_pread_raw arg;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 874
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 875 if (copy_from_user(&arg, uarg, sizeof(arg)))
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 876 return -EFAULT;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 877 if (arg.flags & ~BCH_PREAD_RAW_no_poison_check)
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 878 return -EINVAL;
39fe245ff806f1 Kent Overstreet 2026-03-24 879 if (arg.err.pad)
39fe245ff806f1 Kent Overstreet 2026-03-24 880 return -EINVAL;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 881 if (!arg.len)
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 882 return 0;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 883 if (!(file->f_flags & O_DIRECT))
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 884 return -EINVAL;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 885 if (!inode_owner_or_capable(file_mnt_idmap(file), &inode->v))
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 886 return -EPERM;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 887
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 888 loff_t pos = arg.offset;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 889 int ret = rw_verify_area(READ, file, &pos, arg.len);
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 890 if (ret)
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 891 return ret;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 892
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 893 struct iov_iter iter;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 894 import_ubuf(ITER_DEST, (void __user *)(unsigned long)arg.buf, arg.len, &iter);
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 895
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 896 struct kiocb kiocb;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 897 init_sync_kiocb(&kiocb, file);
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 898 kiocb.ki_pos = arg.offset;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 899
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 900 enum bch_read_flags read_flags = 0;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 901 if (arg.flags & BCH_PREAD_RAW_no_poison_check)
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 902 read_flags |= BCH_READ_no_poison_check;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 903
39fe245ff806f1 Kent Overstreet 2026-03-24 904 struct bch_read_err_report err_report;
39fe245ff806f1 Kent Overstreet 2026-03-24 905 mutex_init(&err_report.lock);
39fe245ff806f1 Kent Overstreet 2026-03-24 906 err_report.errors = 0;
39fe245ff806f1 Kent Overstreet 2026-03-24 907 err_report.msg = (struct printbuf) PRINTBUF;
39fe245ff806f1 Kent Overstreet 2026-03-24 908
39fe245ff806f1 Kent Overstreet 2026-03-24 909 ret = bch2_direct_IO_read(&kiocb, &iter, read_flags, &err_report);
39fe245ff806f1 Kent Overstreet 2026-03-24 910
39fe245ff806f1 Kent Overstreet 2026-03-24 911 if (copy_to_user(&uarg->errors, &err_report.errors, sizeof(err_report.errors)))
39fe245ff806f1 Kent Overstreet 2026-03-24 912 ret = -EFAULT;
39fe245ff806f1 Kent Overstreet 2026-03-24 913
39fe245ff806f1 Kent Overstreet 2026-03-24 @914 int err = bch2_copy_ioctl_err_msg(&arg.err, &err_report.msg, ret < 0 ? ret : 0);
39fe245ff806f1 Kent Overstreet 2026-03-24 915 if (err && !ret)
39fe245ff806f1 Kent Overstreet 2026-03-24 916 ret = err;
39fe245ff806f1 Kent Overstreet 2026-03-24 917
39fe245ff806f1 Kent Overstreet 2026-03-24 918 printbuf_exit(&err_report.msg);
39fe245ff806f1 Kent Overstreet 2026-03-24 919 return ret;
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 920 }
c8c6d24bbb1c2f Kent Overstreet 2026-03-24 921
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-04-07 3:58 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=202604050900.7W0I00dm-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/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