All of lore.kernel.org
 help / color / mirror / Atom feed
* [axboe-block:io_uring-6.11 22/22] io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces)
@ 2024-08-30  4:08 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-08-30  4:08 UTC (permalink / raw)
  To: Jens Axboe; +Cc: oe-kbuild-all, Gabriel Krisman Bertazi

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git io_uring-6.11
head:   41ce1313454c91878970b46ed7efe849921482c6
commit: 41ce1313454c91878970b46ed7efe849921482c6 [22/22] io_uring/rsrc: ensure compat iovecs are copied correctly
config: i386-randconfig-061-20240830 (https://download.01.org/0day-ci/archive/20240830/202408301221.2XMPTbBw-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240830/202408301221.2XMPTbBw-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408301221.2XMPTbBw-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   io_uring/rsrc.c:981:33: sparse: sparse: cast removes address space '__user' of expression
>> io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct iovec const [noderef] __user *uvec @@     got struct iovec *[noderef] __user @@
   io_uring/rsrc.c:981:30: sparse:     expected struct iovec const [noderef] __user *uvec
   io_uring/rsrc.c:981:30: sparse:     got struct iovec *[noderef] __user
   io_uring/rsrc.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   io_uring/rsrc.c: note: in included file (through io_uring/io_uring.h):
   io_uring/filetable.h:66:35: sparse: sparse: restricted io_req_flags_t degrades to integer
   io_uring/rsrc.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   io_uring/rsrc.c: note: in included file (through io_uring/io_uring.h):
   io_uring/filetable.h:66:35: sparse: sparse: restricted io_req_flags_t degrades to integer

vim +981 io_uring/rsrc.c

   951	
   952	int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg,
   953				    unsigned int nr_args, u64 __user *tags)
   954	{
   955		struct page *last_hpage = NULL;
   956		struct io_rsrc_data *data;
   957		struct iovec fast_iov, *iov = &fast_iov;
   958		const struct iovec __user *uvec;
   959		int i, ret;
   960	
   961		BUILD_BUG_ON(IORING_MAX_REG_BUFFERS >= (1u << 16));
   962	
   963		if (ctx->user_bufs)
   964			return -EBUSY;
   965		if (!nr_args || nr_args > IORING_MAX_REG_BUFFERS)
   966			return -EINVAL;
   967		ret = io_rsrc_data_alloc(ctx, IORING_RSRC_BUFFER, tags, nr_args, &data);
   968		if (ret)
   969			return ret;
   970		ret = io_buffers_map_alloc(ctx, nr_args);
   971		if (ret) {
   972			io_rsrc_data_free(data);
   973			return ret;
   974		}
   975	
   976		if (!arg)
   977			memset(iov, 0, sizeof(*iov));
   978	
   979		for (i = 0; i < nr_args; i++, ctx->nr_user_bufs++) {
   980			if (arg) {
 > 981				uvec = (struct iovec * __user) arg;
   982				iov = iovec_from_user(uvec, 1, 1, &fast_iov, ctx->compat);
   983				if (IS_ERR(iov)) {
   984					ret = PTR_ERR(iov);
   985					break;
   986				}
   987				ret = io_buffer_validate(iov);
   988				if (ret)
   989					break;
   990				if (ctx->compat)
   991					arg += sizeof(struct compat_iovec);
   992				else
   993					arg += sizeof(struct iovec);
   994			}
   995	
   996			if (!iov->iov_base && *io_get_tag_slot(data, i)) {
   997				ret = -EINVAL;
   998				break;
   999			}
  1000	
  1001			ret = io_sqe_buffer_register(ctx, iov, &ctx->user_bufs[i],
  1002						     &last_hpage);
  1003			if (ret)
  1004				break;
  1005		}
  1006	
  1007		WARN_ON_ONCE(ctx->buf_data);
  1008	
  1009		ctx->buf_data = data;
  1010		if (ret)
  1011			__io_sqe_buffers_unregister(ctx);
  1012		return ret;
  1013	}
  1014	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [axboe-block:io_uring-6.11 22/22] io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces)
@ 2024-08-30  7:34 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-08-30  7:34 UTC (permalink / raw)
  To: Jens Axboe; +Cc: oe-kbuild-all, Gabriel Krisman Bertazi

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git io_uring-6.11
head:   41ce1313454c91878970b46ed7efe849921482c6
commit: 41ce1313454c91878970b46ed7efe849921482c6 [22/22] io_uring/rsrc: ensure compat iovecs are copied correctly
config: i386-randconfig-061-20240830 (https://download.01.org/0day-ci/archive/20240830/202408301526.kGGDgLFJ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240830/202408301526.kGGDgLFJ-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408301526.kGGDgLFJ-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   io_uring/rsrc.c:981:33: sparse: sparse: cast removes address space '__user' of expression
>> io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct iovec const [noderef] __user *uvec @@     got struct iovec *[noderef] __user @@
   io_uring/rsrc.c:981:30: sparse:     expected struct iovec const [noderef] __user *uvec
   io_uring/rsrc.c:981:30: sparse:     got struct iovec *[noderef] __user
   io_uring/rsrc.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   io_uring/rsrc.c: note: in included file (through io_uring/io_uring.h):
   io_uring/filetable.h:66:35: sparse: sparse: restricted io_req_flags_t degrades to integer
   io_uring/rsrc.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   io_uring/rsrc.c: note: in included file (through io_uring/io_uring.h):
   io_uring/filetable.h:66:35: sparse: sparse: restricted io_req_flags_t degrades to integer

vim +981 io_uring/rsrc.c

   951	
   952	int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg,
   953				    unsigned int nr_args, u64 __user *tags)
   954	{
   955		struct page *last_hpage = NULL;
   956		struct io_rsrc_data *data;
   957		struct iovec fast_iov, *iov = &fast_iov;
   958		const struct iovec __user *uvec;
   959		int i, ret;
   960	
   961		BUILD_BUG_ON(IORING_MAX_REG_BUFFERS >= (1u << 16));
   962	
   963		if (ctx->user_bufs)
   964			return -EBUSY;
   965		if (!nr_args || nr_args > IORING_MAX_REG_BUFFERS)
   966			return -EINVAL;
   967		ret = io_rsrc_data_alloc(ctx, IORING_RSRC_BUFFER, tags, nr_args, &data);
   968		if (ret)
   969			return ret;
   970		ret = io_buffers_map_alloc(ctx, nr_args);
   971		if (ret) {
   972			io_rsrc_data_free(data);
   973			return ret;
   974		}
   975	
   976		if (!arg)
   977			memset(iov, 0, sizeof(*iov));
   978	
   979		for (i = 0; i < nr_args; i++, ctx->nr_user_bufs++) {
   980			if (arg) {
 > 981				uvec = (struct iovec * __user) arg;
   982				iov = iovec_from_user(uvec, 1, 1, &fast_iov, ctx->compat);
   983				if (IS_ERR(iov)) {
   984					ret = PTR_ERR(iov);
   985					break;
   986				}
   987				ret = io_buffer_validate(iov);
   988				if (ret)
   989					break;
   990				if (ctx->compat)
   991					arg += sizeof(struct compat_iovec);
   992				else
   993					arg += sizeof(struct iovec);
   994			}
   995	
   996			if (!iov->iov_base && *io_get_tag_slot(data, i)) {
   997				ret = -EINVAL;
   998				break;
   999			}
  1000	
  1001			ret = io_sqe_buffer_register(ctx, iov, &ctx->user_bufs[i],
  1002						     &last_hpage);
  1003			if (ret)
  1004				break;
  1005		}
  1006	
  1007		WARN_ON_ONCE(ctx->buf_data);
  1008	
  1009		ctx->buf_data = data;
  1010		if (ret)
  1011			__io_sqe_buffers_unregister(ctx);
  1012		return ret;
  1013	}
  1014	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-30  7:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30  4:08 [axboe-block:io_uring-6.11 22/22] io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces) kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-08-30  7:34 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.