[ammarfaizi2-block:axboe/linux-block/for-5.19/io_uring-pbuf 75/84] fs/io_uring.c:3599:23: sparse: sparse: incorrect type in return expression (different address spaces)

From: kernel test robot
Date: Fri Apr 29 2022 - 20:30:43 EST


tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/for-5.19/io_uring-pbuf
head: 074a323cc380d98290411884e8eb4c3ca7effb87
commit: d84cb823377d1cd0b056c07f404c69671193e795 [75/84] io_uring: make io_buffer_select() return the user address directly
config: arc-randconfig-s031-20220429 (https://download.01.org/0day-ci/archive/20220430/202204300822.PgmiQykR-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 11.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/ammarfaizi2/linux-block/commit/d84cb823377d1cd0b056c07f404c69671193e795
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/for-5.19/io_uring-pbuf
git checkout d84cb823377d1cd0b056c07f404c69671193e795
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
fs/io_uring.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/io_uring.h):
include/trace/events/io_uring.h:493:1: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] op_flags @@ got restricted __kernel_rwf_t const [usertype] rw_flags @@
include/trace/events/io_uring.h:493:1: sparse: expected unsigned int [usertype] op_flags
include/trace/events/io_uring.h:493:1: sparse: got restricted __kernel_rwf_t const [usertype] rw_flags
fs/io_uring.c:3414:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] flags @@ got restricted __kernel_rwf_t @@
fs/io_uring.c:3414:23: sparse: expected unsigned int [usertype] flags
fs/io_uring.c:3414:23: sparse: got restricted __kernel_rwf_t
>> fs/io_uring.c:3599:23: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] __user * @@ got void * @@
fs/io_uring.c:3599:23: sparse: expected void [noderef] __user *
fs/io_uring.c:3599:23: sparse: got void *
fs/io_uring.c:3991:48: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __kernel_rwf_t [usertype] flags @@ got unsigned int [usertype] flags @@
fs/io_uring.c:3991:48: sparse: expected restricted __kernel_rwf_t [usertype] flags
fs/io_uring.c:3991:48: sparse: got unsigned int [usertype] flags
fs/io_uring.c:5565:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file *file @@ got struct file [noderef] __rcu * @@
fs/io_uring.c:5565:14: sparse: expected struct file *file
fs/io_uring.c:5565:14: sparse: got struct file [noderef] __rcu *
fs/io_uring.c:6402:68: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __poll_t [usertype] _key @@ got int apoll_events @@
fs/io_uring.c:6402:68: sparse: expected restricted __poll_t [usertype] _key
fs/io_uring.c:6402:68: sparse: got int apoll_events
fs/io_uring.c:6407:48: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6411:59: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6412:66: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __poll_t [usertype] val @@ got int @@
fs/io_uring.c:6412:66: sparse: expected restricted __poll_t [usertype] val
fs/io_uring.c:6412:66: sparse: got int
fs/io_uring.c:6412:52: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __poll_t [usertype] mask @@ got unsigned short @@
fs/io_uring.c:6412:52: sparse: expected restricted __poll_t [usertype] mask
fs/io_uring.c:6412:52: sparse: got unsigned short
fs/io_uring.c:6416:75: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected signed int [usertype] res @@ got restricted __poll_t [usertype] mask @@
fs/io_uring.c:6416:75: sparse: expected signed int [usertype] res
fs/io_uring.c:6416:75: sparse: got restricted __poll_t [usertype] mask
fs/io_uring.c:6446:68: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6446:57: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __poll_t [usertype] val @@ got unsigned int @@
fs/io_uring.c:6446:57: sparse: expected restricted __poll_t [usertype] val
fs/io_uring.c:6446:57: sparse: got unsigned int
fs/io_uring.c:6527:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6527:45: sparse: expected int events
fs/io_uring.c:6527:45: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6562:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected int mask @@ got restricted __poll_t [usertype] mask @@
fs/io_uring.c:6562:40: sparse: expected int mask
fs/io_uring.c:6562:40: sparse: got restricted __poll_t [usertype] mask
fs/io_uring.c:6562:50: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6562:50: sparse: expected int events
fs/io_uring.c:6562:50: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6654:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __poll_t [assigned] [usertype] mask @@
fs/io_uring.c:6654:24: sparse: expected int
fs/io_uring.c:6654:24: sparse: got restricted __poll_t [assigned] [usertype] mask
fs/io_uring.c:6671:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected int mask @@ got restricted __poll_t [assigned] [usertype] mask @@
fs/io_uring.c:6671:40: sparse: expected int mask
fs/io_uring.c:6671:40: sparse: got restricted __poll_t [assigned] [usertype] mask
fs/io_uring.c:6671:50: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6671:50: sparse: expected int events
fs/io_uring.c:6671:50: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6681:47: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6681:47: sparse: expected int events
fs/io_uring.c:6681:47: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6706:25: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6706:48: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __poll_t [usertype] mask @@ got unsigned int @@
fs/io_uring.c:6706:48: sparse: expected restricted __poll_t [usertype] mask
fs/io_uring.c:6706:48: sparse: got unsigned int
fs/io_uring.c:6717:22: sparse: sparse: invalid assignment: |=
fs/io_uring.c:6717:22: sparse: left side has type restricted __poll_t
fs/io_uring.c:6717:22: sparse: right side has type int
fs/io_uring.c:6722:30: sparse: sparse: invalid assignment: &=
fs/io_uring.c:6722:30: sparse: left side has type restricted __poll_t
fs/io_uring.c:6722:30: sparse: right side has type int
fs/io_uring.c:6724:22: sparse: sparse: invalid assignment: |=
fs/io_uring.c:6724:22: sparse: left side has type restricted __poll_t
fs/io_uring.c:6724:22: sparse: right side has type int
fs/io_uring.c:6752:33: sparse: sparse: incorrect type in argument 5 (different base types) @@ expected int mask @@ got restricted __poll_t [assigned] [usertype] mask @@
fs/io_uring.c:6752:33: sparse: expected int mask
fs/io_uring.c:6752:33: sparse: got restricted __poll_t [assigned] [usertype] mask
fs/io_uring.c:6752:50: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected int events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6752:50: sparse: expected int events
fs/io_uring.c:6752:50: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6866:24: sparse: sparse: invalid assignment: |=
fs/io_uring.c:6866:24: sparse: left side has type unsigned int
fs/io_uring.c:6866:24: sparse: right side has type restricted __poll_t
fs/io_uring.c:6867:65: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6867:29: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6867:38: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __poll_t @@ got unsigned int @@
fs/io_uring.c:6867:38: sparse: expected restricted __poll_t
fs/io_uring.c:6867:38: sparse: got unsigned int
fs/io_uring.c:6919:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected int apoll_events @@ got restricted __poll_t [usertype] events @@
fs/io_uring.c:6919:27: sparse: expected int apoll_events
fs/io_uring.c:6919:27: sparse: got restricted __poll_t [usertype] events
fs/io_uring.c:6958:43: sparse: sparse: invalid assignment: &=
fs/io_uring.c:6958:43: sparse: left side has type restricted __poll_t
fs/io_uring.c:6958:43: sparse: right side has type int
fs/io_uring.c:6959:62: sparse: sparse: restricted __poll_t degrades to integer
fs/io_uring.c:6959:43: sparse: sparse: invalid assignment: |=
fs/io_uring.c:6959:43: sparse: left side has type restricted __poll_t
fs/io_uring.c:6959:43: sparse: right side has type unsigned int
fs/io_uring.c:2663:17: sparse: sparse: context imbalance in 'handle_prev_tw_list' - different lock contexts for basic block
fs/io_uring.c:8058:39: sparse: sparse: marked inline, but without a definition
fs/io_uring.c:8058:39: sparse: sparse: marked inline, but without a definition
fs/io_uring.c:8058:39: sparse: sparse: marked inline, but without a definition
fs/io_uring.c:8058:39: sparse: sparse: marked inline, but without a definition

vim +3599 fs/io_uring.c

3573
3574 static void __user *io_buffer_select(struct io_kiocb *req, size_t *len,
3575 int bgid, unsigned int issue_flags)
3576 {
3577 struct io_buffer *kbuf = req->kbuf;
3578 struct io_ring_ctx *ctx = req->ctx;
3579 struct io_buffer_list *bl;
3580
3581 if (req->flags & REQ_F_BUFFER_SELECTED)
3582 return u64_to_user_ptr(kbuf->addr);
3583
3584 io_ring_submit_lock(req->ctx, issue_flags);
3585
3586 bl = io_buffer_get_list(ctx, bgid);
3587 if (bl && !list_empty(&bl->buf_list)) {
3588 kbuf = list_first_entry(&bl->buf_list, struct io_buffer, list);
3589 list_del(&kbuf->list);
3590 if (*len > kbuf->len)
3591 *len = kbuf->len;
3592 req->flags |= REQ_F_BUFFER_SELECTED;
3593 req->kbuf = kbuf;
3594 io_ring_submit_unlock(req->ctx, issue_flags);
3595 return u64_to_user_ptr(kbuf->addr);
3596 }
3597
3598 io_ring_submit_unlock(req->ctx, issue_flags);
> 3599 return ERR_PTR(-ENOBUFS);
3600 }
3601

--
0-DAY CI Kernel Test Service
https://01.org/lkp