All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: oe-kbuild-all@lists.linux.dev, Gabriel Krisman Bertazi <krisman@suse.de>
Subject: [axboe-block:io_uring-6.11 22/22] io_uring/rsrc.c:981:30: sparse: sparse: incorrect type in assignment (different address spaces)
Date: Fri, 30 Aug 2024 12:08:23 +0800	[thread overview]
Message-ID: <202408301221.2XMPTbBw-lkp@intel.com> (raw)

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

             reply	other threads:[~2024-08-30  4:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  4:08 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-30  7:34 [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

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=202408301221.2XMPTbBw-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=krisman@suse.de \
    --cc=oe-kbuild-all@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 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.