tree:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
for-5.13/io_uring
head: cad640129f844fcb72750f4cced5041ead287cbe
commit: 504a5bb259c88ae14141660adc048919f54b6d6b [94/106] io_uring: refactor io_close
config: x86_64-randconfig-s021-20210411 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
#
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/com...
git remote add block
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags block for-5.13/io_uring
git checkout 504a5bb259c88ae14141660adc048919f54b6d6b
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
fs/io_uring.c:2876:24: sparse: sparse: incorrect type in return expression (different
address spaces) @@ expected void [noderef] __user * @@ got struct io_buffer
*[assigned] kbuf @@
fs/io_uring.c:2876:24: sparse: expected void [noderef] __user *
fs/io_uring.c:2876:24: sparse: got struct io_buffer *[assigned] kbuf
> fs/io_uring.c:4174:14: sparse: sparse: incorrect type in
assignment (different address spaces) @@ expected struct file *file @@ got struct
file [noderef] __rcu * @@
fs/io_uring.c:4174:14: sparse: expected struct file
*file
fs/io_uring.c:4174:14: sparse: got struct file [noderef] __rcu *
fs/io_uring.c:4781:72: sparse: sparse: incorrect type in argument 4 (different base
types) @@ expected int mask @@ got restricted __poll_t [usertype] mask @@
fs/io_uring.c:4781:72: sparse: expected int mask
fs/io_uring.c:4781:72: sparse: got restricted __poll_t [usertype] mask
fs/io_uring.c:4785:21: sparse: sparse: incorrect type in assignment (different base
types) @@ expected unsigned int [usertype] result @@ got restricted __poll_t
[usertype] mask @@
fs/io_uring.c:4785:21: sparse: expected unsigned int [usertype] result
fs/io_uring.c:4785:21: sparse: got restricted __poll_t [usertype] mask
fs/io_uring.c:4810:29: sparse: sparse: incorrect type in assignment (different base
types) @@ expected unsigned int [usertype] result @@ got restricted __poll_t @@
fs/io_uring.c:4810:29: sparse: expected unsigned int [usertype] result
fs/io_uring.c:4810:29: sparse: got restricted __poll_t
fs/io_uring.c:4891:49: sparse: sparse: incorrect type in argument 2 (different base
types) @@ expected restricted __poll_t [usertype] mask @@ got unsigned int
[usertype] result @@
fs/io_uring.c:4891:49: sparse: expected restricted __poll_t [usertype] mask
fs/io_uring.c:4891:49: sparse: got unsigned int [usertype] result
fs/io_uring.c:5041:41: sparse: sparse: incorrect type in argument 4 (different base
types) @@ expected int mask @@ got restricted __poll_t [usertype] @@
fs/io_uring.c:5041:41: sparse: expected int mask
fs/io_uring.c:5041:41: sparse: got restricted __poll_t [usertype]
fs/io_uring.c:5129:22: sparse: sparse: invalid assignment: |=
fs/io_uring.c:5129:22: sparse: left side has type restricted __poll_t
fs/io_uring.c:5129:22: sparse: right side has type int
fs/io_uring.c:5131:22: sparse: sparse: invalid assignment: |=
fs/io_uring.c:5131:22: sparse: left side has type restricted __poll_t
fs/io_uring.c:5131:22: sparse: right side has type int
fs/io_uring.c:5136:22: sparse: sparse: invalid assignment: &=
fs/io_uring.c:5136:22: sparse: left side has type restricted __poll_t
fs/io_uring.c:5136:22: sparse: right side has type int
fs/io_uring.c:5138:14: sparse: sparse: invalid assignment: |=
fs/io_uring.c:5138:14: sparse: left side has type restricted __poll_t
fs/io_uring.c:5138:14: sparse: right side has type int
fs/io_uring.c:5152:67: sparse: sparse: incorrect type in argument 4 (different base
types) @@ expected int mask @@ got restricted __poll_t [assigned] [usertype] mask
@@
fs/io_uring.c:5152:67: sparse: expected int mask
fs/io_uring.c:5152:67: sparse: got restricted __poll_t [assigned] [usertype] mask
fs/io_uring.c:5153:52: sparse: sparse: incorrect type in argument 5 (different base
types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:5153:52: sparse: expected int events
fs/io_uring.c:5153:52: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:5342:24: sparse: sparse: invalid assignment: |=
fs/io_uring.c:5342:24: sparse: left side has type unsigned int
fs/io_uring.c:5342:24: sparse: right side has type restricted __poll_t
fs/io_uring.c:5356:58: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:5355:37: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:5355:22: sparse: sparse: incorrect type in assignment (different base
types) @@ expected restricted __poll_t [usertype] events @@ got unsigned int @@
fs/io_uring.c:5355:22: sparse: expected restricted __poll_t [usertype] events
fs/io_uring.c:5355:22: sparse: got unsigned int
fs/io_uring.c:5425:35: sparse: sparse: invalid assignment: &=
fs/io_uring.c:5425:35: sparse: left side has type restricted __poll_t
fs/io_uring.c:5425:35: sparse: right side has type int
fs/io_uring.c:5426:47: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:5426:35: sparse: sparse: invalid assignment: |=
fs/io_uring.c:5426:35: sparse: left side has type restricted __poll_t
fs/io_uring.c:5426:35: sparse: right side has type unsigned int
fs/io_uring.c:7204:9: sparse: sparse: context imbalance in
'io_sq_thread_unpark' - wrong count at exit
fs/io_uring.c:7215:9: sparse: sparse: context imbalance in 'io_sq_thread_park'
- wrong count at exit
vim +4174 fs/io_uring.c
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4159
889fca73287b0a Pavel Begunkov 2021-02-10 4160 static int io_close(struct io_kiocb *req,
unsigned int issue_flags)
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4161 {
9eac1904d33642 Jens Axboe 2021-01-19 4162 struct files_struct *files =
current->files;
3af73b286ccee4 Pavel Begunkov 2020-06-08 4163 struct io_close *close =
&req->close;
9eac1904d33642 Jens Axboe 2021-01-19 4164 struct fdtable *fdt;
504a5bb259c88a Pavel Begunkov 2021-04-11 4165 struct file *file = NULL;
504a5bb259c88a Pavel Begunkov 2021-04-11 4166 int ret = -EBADF;
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4167
9eac1904d33642 Jens Axboe 2021-01-19 4168 spin_lock(&files->file_lock);
9eac1904d33642 Jens Axboe 2021-01-19 4169 fdt = files_fdtable(files);
9eac1904d33642 Jens Axboe 2021-01-19 4170 if (close->fd >= fdt->max_fds)
{
9eac1904d33642 Jens Axboe 2021-01-19 4171 spin_unlock(&files->file_lock);
9eac1904d33642 Jens Axboe 2021-01-19 4172 goto err;
9eac1904d33642 Jens Axboe 2021-01-19 4173 }
9eac1904d33642 Jens Axboe 2021-01-19 @4174 file = fdt->fd[close->fd];
504a5bb259c88a Pavel Begunkov 2021-04-11 4175 if (!file || file->f_op ==
&io_uring_fops) {
9eac1904d33642 Jens Axboe 2021-01-19 4176 spin_unlock(&files->file_lock);
9eac1904d33642 Jens Axboe 2021-01-19 4177 file = NULL;
9eac1904d33642 Jens Axboe 2021-01-19 4178 goto err;
3af73b286ccee4 Pavel Begunkov 2020-06-08 4179 }
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4180
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4181 /* if the file has a flush method, be
safe and punt to async */
45d189c6062922 Pavel Begunkov 2021-02-10 4182 if (file->f_op->flush &&
(issue_flags & IO_URING_F_NONBLOCK)) {
9eac1904d33642 Jens Axboe 2021-01-19 4183 spin_unlock(&files->file_lock);
0bf0eefdab52d9 Pavel Begunkov 2020-05-26 4184 return -EAGAIN;
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4185 }
b5dba59e0cf7e2 Jens Axboe 2019-12-11 4186
9eac1904d33642 Jens Axboe 2021-01-19 4187 ret = __close_fd_get_file(close->fd,
&file);
9eac1904d33642 Jens Axboe 2021-01-19 4188 spin_unlock(&files->file_lock);
9eac1904d33642 Jens Axboe 2021-01-19 4189 if (ret < 0) {
9eac1904d33642 Jens Axboe 2021-01-19 4190 if (ret == -ENOENT)
9eac1904d33642 Jens Axboe 2021-01-19 4191 ret = -EBADF;
9eac1904d33642 Jens Axboe 2021-01-19 4192 goto err;
9eac1904d33642 Jens Axboe 2021-01-19 4193 }
9eac1904d33642 Jens Axboe 2021-01-19 4194
3af73b286ccee4 Pavel Begunkov 2020-06-08 4195 /* No ->flush() or already async,
safely close from here */
9eac1904d33642 Jens Axboe 2021-01-19 4196 ret = filp_close(file,
current->files);
9eac1904d33642 Jens Axboe 2021-01-19 4197 err:
3af73b286ccee4 Pavel Begunkov 2020-06-08 4198 if (ret < 0)
3af73b286ccee4 Pavel Begunkov 2020-06-08 4199 req_set_fail_links(req);
9eac1904d33642 Jens Axboe 2021-01-19 4200 if (file)
9eac1904d33642 Jens Axboe 2021-01-19 4201 fput(file);
889fca73287b0a Pavel Begunkov 2021-02-10 4202 __io_req_complete(req, issue_flags, ret,
0);
a2100672f3b2af Pavel Begunkov 2020-03-02 4203 return 0;
a2100672f3b2af Pavel Begunkov 2020-03-02 4204 }
a2100672f3b2af Pavel Begunkov 2020-03-02 4205
:::::: The code at line 4174 was first introduced by commit
:::::: 9eac1904d3364254d622bf2c771c4f85cd435fc2 io_uring: get rid of intermediate
IORING_OP_CLOSE stage
:::::: TO: Jens Axboe <axboe(a)kernel.dk>
:::::: CC: Jens Axboe <axboe(a)kernel.dk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org