Re: [PATCH v8 3/6] iio: core: Add new DMABUF interface infrastructure

From: kernel test robot
Date: Sun Mar 10 2024 - 03:20:19 EST


Hi Paul,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on vkoul-dmaengine/next lwn/docs-next linus/master v6.8-rc7 next-20240308]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/dmaengine-Add-API-function-dmaengine_prep_peripheral_dma_vec/20240309-010421
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20240308170046.92899-4-paul%40crapouillou.net
patch subject: [PATCH v8 3/6] iio: core: Add new DMABUF interface infrastructure
config: i386-randconfig-062-20240309 (https://download.01.org/0day-ci/archive/20240310/202403101535.uRqo6AIt-lkp@xxxxxxxxx/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/20240310/202403101535.uRqo6AIt-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403101535.uRqo6AIt-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/iio/industrialio-buffer.c:1765:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got int *user_req @@
drivers/iio/industrialio-buffer.c:1765:40: sparse: expected void const [noderef] __user *from
drivers/iio/industrialio-buffer.c:1765:40: sparse: got int *user_req
>> drivers/iio/industrialio-buffer.c:1988:53: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected int *user_req @@ got void [noderef] __user *_arg @@
drivers/iio/industrialio-buffer.c:1988:53: sparse: expected int *user_req
drivers/iio/industrialio-buffer.c:1988:53: sparse: got void [noderef] __user *_arg
drivers/iio/industrialio-buffer.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, ...):
include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false

vim +1765 drivers/iio/industrialio-buffer.c

1755
1756 static int iio_buffer_detach_dmabuf(struct iio_dev_buffer_pair *ib,
1757 int *user_req, bool nonblock)
1758 {
1759 struct iio_buffer *buffer = ib->buffer;
1760 struct iio_dev *indio_dev = ib->indio_dev;
1761 struct iio_dmabuf_priv *priv;
1762 struct dma_buf *dmabuf;
1763 int dmabuf_fd, ret = -EPERM;
1764
> 1765 if (copy_from_user(&dmabuf_fd, user_req, sizeof(dmabuf_fd)))
1766 return -EFAULT;
1767
1768 dmabuf = dma_buf_get(dmabuf_fd);
1769 if (IS_ERR(dmabuf))
1770 return PTR_ERR(dmabuf);
1771
1772 mutex_lock(&buffer->dmabufs_mutex);
1773
1774 list_for_each_entry(priv, &buffer->dmabufs, entry) {
1775 if (priv->attach->dev == indio_dev->dev.parent
1776 && priv->attach->dmabuf == dmabuf) {
1777 list_del(&priv->entry);
1778
1779 /* Unref the reference from iio_buffer_attach_dmabuf() */
1780 iio_buffer_dmabuf_put(priv->attach);
1781 ret = 0;
1782 break;
1783 }
1784 }
1785
1786 mutex_unlock(&buffer->dmabufs_mutex);
1787 dma_buf_put(dmabuf);
1788
1789 return ret;
1790 }
1791

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