lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202209302235.hHrSjkSb-lkp@intel.com>
Date:   Fri, 30 Sep 2022 22:17:58 +0800
From:   kernel test robot <lkp@...el.com>
To:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Matti Vaittinen <mazziesaccount@...il.com>
Cc:     kbuild-all@...ts.01.org,
        Cosmin Tanislav <cosmin.tanislav@...log.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Eugen Hristev <eugen.hristev@...rochip.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Miaoqian Lin <linmq006@...il.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Mihail Chindris <mihail.chindris@...log.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/2] iio: Fix unsafe buffer attributes

Hi Matti,

I love your patch! Yet something to improve:

[auto build test ERROR on v6.0-rc7]
[also build test ERROR on linus/master]
[cannot apply to jic23-iio/togreg next-20220929]
[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/Matti-Vaittinen/iio-Add-IIO_STATIC_CONST_DEVICE_ATTR/20220930-191558
base:    f76349cf41451c5c42a99f18a9163377e4b364ff
config: sh-allmodconfig
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/71aecc2b7a59a431f1a4ca7f6e4670f6ca889cb0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Matti-Vaittinen/iio-Add-IIO_STATIC_CONST_DEVICE_ATTR/20220930-191558
        git checkout 71aecc2b7a59a431f1a4ca7f6e4670f6ca889cb0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/iio/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   drivers/iio/buffer/industrialio-buffer-dmaengine.c: In function 'iio_dmaengine_buffer_alloc':
>> drivers/iio/buffer/industrialio-buffer-dmaengine.c:204:46: error: assignment to 'const struct iio_dev_attr **' from incompatible pointer type 'const struct attribute **' [-Werror=incompatible-pointer-types]
     204 |         dmaengine_buffer->queue.buffer.attrs = iio_dmaengine_buffer_attrs;
         |                                              ^
   cc1: some warnings being treated as errors
--
   drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c: In function 'cros_ec_sensors_core_init':
>> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:336:63: error: passing argument 4 of 'devm_iio_kfifo_buffer_setup_ext' from incompatible pointer type [-Werror=incompatible-pointer-types]
     336 |                                                               cros_ec_sensor_fifo_attributes);
         |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               const struct attribute **
   In file included from drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:13:
   include/linux/iio/kfifo_buf.h:17:65: note: expected 'const struct iio_dev_attr **' but argument is of type 'const struct attribute **'
      17 |                                     const struct iio_dev_attr **buffer_attrs);
         |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +204 drivers/iio/buffer/industrialio-buffer-dmaengine.c

4538c185680996 Lars-Peter Clausen 2019-12-11  149  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  150  /**
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  151   * iio_dmaengine_buffer_alloc() - Allocate new buffer which uses DMAengine
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  152   * @dev: Parent device for the buffer
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  153   * @channel: DMA channel name, typically "rx".
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  154   *
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  155   * This allocates a new IIO buffer which internally uses the DMAengine framework
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  156   * to perform its transfers. The parent device will be used to request the DMA
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  157   * channel.
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  158   *
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  159   * Once done using the buffer iio_dmaengine_buffer_free() should be used to
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  160   * release it.
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  161   */
25918a9c641c3c Alexandru Ardelean 2020-09-23  162  static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  163  	const char *channel)
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  164  {
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  165  	struct dmaengine_buffer *dmaengine_buffer;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  166  	unsigned int width, src_width, dest_width;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  167  	struct dma_slave_caps caps;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  168  	struct dma_chan *chan;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  169  	int ret;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  170  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  171  	dmaengine_buffer = kzalloc(sizeof(*dmaengine_buffer), GFP_KERNEL);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  172  	if (!dmaengine_buffer)
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  173  		return ERR_PTR(-ENOMEM);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  174  
f339f979bb333e Peter Ujfalusi     2019-11-13  175  	chan = dma_request_chan(dev, channel);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  176  	if (IS_ERR(chan)) {
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  177  		ret = PTR_ERR(chan);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  178  		goto err_free;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  179  	}
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  180  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  181  	ret = dma_get_slave_caps(chan, &caps);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  182  	if (ret < 0)
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  183  		goto err_free;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  184  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  185  	/* Needs to be aligned to the maximum of the minimums */
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  186  	if (caps.src_addr_widths)
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  187  		src_width = __ffs(caps.src_addr_widths);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  188  	else
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  189  		src_width = 1;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  190  	if (caps.dst_addr_widths)
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  191  		dest_width = __ffs(caps.dst_addr_widths);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  192  	else
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  193  		dest_width = 1;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  194  	width = max(src_width, dest_width);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  195  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  196  	INIT_LIST_HEAD(&dmaengine_buffer->active);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  197  	dmaengine_buffer->chan = chan;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  198  	dmaengine_buffer->align = width;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  199  	dmaengine_buffer->max_size = dma_get_max_seg_size(chan->device->dev);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  200  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  201  	iio_dma_buffer_init(&dmaengine_buffer->queue, chan->device->dev,
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  202  		&iio_dmaengine_default_ops);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  203  
5e6dc43e2caa14 Alexandru Ardelean 2020-09-29 @204  	dmaengine_buffer->queue.buffer.attrs = iio_dmaengine_buffer_attrs;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  205  	dmaengine_buffer->queue.buffer.access = &iio_dmaengine_buffer_ops;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  206  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  207  	return &dmaengine_buffer->queue.buffer;
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  208  
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  209  err_free:
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  210  	kfree(dmaengine_buffer);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  211  	return ERR_PTR(ret);
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  212  }
2d6ca60f328450 Lars-Peter Clausen 2015-10-13  213  

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

View attachment "config" of type "text/plain" (241788 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ