Skip to contentSkip to conversation

io_uring/rw.c:291:19: sparse: sparse: incorrect type in assignment (different base types)

PATCH kernel test robot 1 participant 1 message Jul 3, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8d6c58332c7a8ba025fcfa76888b6c37dbce9633
commit: cf73d9970ea4f8cace5d8f02d2565a2723003112 [6809/7039] io_uring: don't use int for ABI
config: i386-randconfig-063-20250703 (https://download.01.org/0day-ci/archive/20250703/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250703/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> io_uring/rw.c:291:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __kernel_rwf_t [usertype] flags @@     got unsigned int @@

io_uring/rw.c:291:19: sparse: expected restricted __kernel_rwf_t [usertype] flags
io_uring/rw.c:291:19: sparse: got unsigned int

vim +291 io_uring/rw.c

a9165b83c1937e Jens Axboe        2024-03-18  251  
2a61e63891add7 Keith Busch       2025-02-27  252  static int __io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
2a61e63891add7 Keith Busch       2025-02-27  253  			int ddir)
f3b44f92e59a80 Jens Axboe        2022-06-13  254  {
f2ccb5aed7bce1 Stefan Metzmacher 2022-08-11  255  	struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
c0e965052149c8 Pavel Begunkov    2025-03-31  256  	struct io_async_rw *io;
f3b44f92e59a80 Jens Axboe        2022-06-13  257  	unsigned ioprio;
59a7d12a7fb5ab Anuj Gupta        2024-11-28  258  	u64 attr_type_mask;
f3b44f92e59a80 Jens Axboe        2022-06-13  259  	int ret;
f3b44f92e59a80 Jens Axboe        2022-06-13  260  
c72282dd865ee6 Pavel Begunkov    2025-02-24  261  	if (io_rw_alloc_async(req))
c72282dd865ee6 Pavel Begunkov    2025-02-24  262  		return -ENOMEM;
c0e965052149c8 Pavel Begunkov    2025-03-31  263  	io = req->async_data;
c72282dd865ee6 Pavel Begunkov    2025-02-24  264  
f3b44f92e59a80 Jens Axboe        2022-06-13  265  	rw->kiocb.ki_pos = READ_ONCE(sqe->off);
f3b44f92e59a80 Jens Axboe        2022-06-13  266  	/* used for fixed read/write too - just read unconditionally */
f3b44f92e59a80 Jens Axboe        2022-06-13  267  	req->buf_index = READ_ONCE(sqe->buf_index);
c0e965052149c8 Pavel Begunkov    2025-03-31  268  	io->buf_group = req->buf_index;
f3b44f92e59a80 Jens Axboe        2022-06-13  269  
f3b44f92e59a80 Jens Axboe        2022-06-13  270  	ioprio = READ_ONCE(sqe->ioprio);
f3b44f92e59a80 Jens Axboe        2022-06-13  271  	if (ioprio) {
f3b44f92e59a80 Jens Axboe        2022-06-13  272  		ret = ioprio_check_cap(ioprio);
f3b44f92e59a80 Jens Axboe        2022-06-13  273  		if (ret)
f3b44f92e59a80 Jens Axboe        2022-06-13  274  			return ret;
f3b44f92e59a80 Jens Axboe        2022-06-13  275  
f3b44f92e59a80 Jens Axboe        2022-06-13  276  		rw->kiocb.ki_ioprio = ioprio;
f3b44f92e59a80 Jens Axboe        2022-06-13  277  	} else {
f3b44f92e59a80 Jens Axboe        2022-06-13  278  		rw->kiocb.ki_ioprio = get_current_ioprio();
f3b44f92e59a80 Jens Axboe        2022-06-13  279  	}
099ada2c87260e Jens Axboe        2023-07-08  280  	rw->kiocb.dio_complete = NULL;
59a7d12a7fb5ab Anuj Gupta        2024-11-28  281  	rw->kiocb.ki_flags = 0;
02040353f4fedb Keith Busch       2025-05-06  282  	rw->kiocb.ki_write_stream = READ_ONCE(sqe->write_stream);
f3b44f92e59a80 Jens Axboe        2022-06-13  283  
74f3e875268f1c Pavel Begunkov    2025-02-19  284  	if (req->ctx->flags & IORING_SETUP_IOPOLL)
74f3e875268f1c Pavel Begunkov    2025-02-19  285  		rw->kiocb.ki_complete = io_complete_rw_iopoll;
74f3e875268f1c Pavel Begunkov    2025-02-19  286  	else
74f3e875268f1c Pavel Begunkov    2025-02-19  287  		rw->kiocb.ki_complete = io_complete_rw;
74f3e875268f1c Pavel Begunkov    2025-02-19  288  
f3b44f92e59a80 Jens Axboe        2022-06-13  289  	rw->addr = READ_ONCE(sqe->addr);
f3b44f92e59a80 Jens Axboe        2022-06-13  290  	rw->len = READ_ONCE(sqe->len);
f3b44f92e59a80 Jens Axboe        2022-06-13 @291  	rw->flags = READ_ONCE(sqe->rw_flags);
59a7d12a7fb5ab Anuj Gupta        2024-11-28  292  
59a7d12a7fb5ab Anuj Gupta        2024-11-28  293  	attr_type_mask = READ_ONCE(sqe->attr_type_mask);
59a7d12a7fb5ab Anuj Gupta        2024-11-28  294  	if (attr_type_mask) {
59a7d12a7fb5ab Anuj Gupta        2024-11-28  295  		u64 attr_ptr;
59a7d12a7fb5ab Anuj Gupta        2024-11-28  296  
59a7d12a7fb5ab Anuj Gupta        2024-11-28  297  		/* only PI attribute is supported currently */
59a7d12a7fb5ab Anuj Gupta        2024-11-28  298  		if (attr_type_mask != IORING_RW_ATTR_FLAG_PI)
59a7d12a7fb5ab Anuj Gupta        2024-11-28  299  			return -EINVAL;
59a7d12a7fb5ab Anuj Gupta        2024-11-28  300  
59a7d12a7fb5ab Anuj Gupta        2024-11-28  301  		attr_ptr = READ_ONCE(sqe->attr_ptr);
7a9b0d6925b2b1 Pavel Begunkov    2025-02-24  302  		return io_prep_rw_pi(req, rw, ddir, attr_ptr, attr_type_mask);
59a7d12a7fb5ab Anuj Gupta        2024-11-28  303  	}
7a9b0d6925b2b1 Pavel Begunkov    2025-02-24  304  	return 0;
a9165b83c1937e Jens Axboe        2024-03-18  305  }
a9165b83c1937e Jens Axboe        2024-03-18  306  

:::::: The code at line 291 was first introduced by commit
:::::: f3b44f92e59a804cf375479bda0bccbf4b6e6ef6 io_uring: move read/write related opcodes to its own file

:::::: TO: Jens Axboe <[email protected]>
:::::: CC: Jens Axboe <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki