[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202205162305.tBuUiz79-lkp@intel.com>
Date: Mon, 16 May 2022 23:30:36 +0800
From: kernel test robot <lkp@...el.com>
To: Yaşar Arabacı <yasar11732@...il.com>,
gregkh@...uxfoundation.org
Cc: kbuild-all@...ts.01.org, paulo.miguel.almeida.rodenas@...il.com,
dan.carpenter@...cle.com, alexandre.belloni@...tlin.com,
realwakka@...il.com, u.kleine-koenig@...gutronix.de,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Yaşar Arabacı <yasar11732@...il.com>
Subject: Re: [PATCH] Staging: pi433: Don't use ioctl for per-client
configuration
Hi "Yaşar,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Ya-ar-Arabac/Staging-pi433-Don-t-use-ioctl-for-per-client-configuration/20220515-185057
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git e41f7a5521d7f03dca99e3207633df71740569dd
config: x86_64-randconfig-s022-20220516 (https://download.01.org/0day-ci/archive/20220516/202205162305.tBuUiz79-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/intel-lab-lkp/linux/commit/0cfbff215eb0e9e558af6b491d319fc736a927c6
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ya-ar-Arabac/Staging-pi433-Don-t-use-ioctl-for-per-client-configuration/20220515-185057
git checkout 0cfbff215eb0e9e558af6b491d319fc736a927c6
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/staging/pi433/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/staging/pi433/pi433_if.c:816:19: sparse: sparse: cast removes address space '__user' of expression
vim +/__user +816 drivers/staging/pi433/pi433_if.c
792
793 static ssize_t
794 pi433_write(struct file *filp, const char __user *buf,
795 size_t count, loff_t *f_pos)
796 {
797 struct pi433_instance *instance;
798 struct pi433_tx_cfg *tx_cfg;
799 struct pi433_device *device;
800 int retval;
801 unsigned int required, available, copied;
802
803 instance = filp->private_data;
804 device = instance->device;
805
806 /*
807 * check, whether internal buffer (tx thread) is big enough
808 * for requested size
809 */
810 if (unlikely(count > MAX_MSG_SIZE))
811 return -EMSGSIZE;
812
813 if (unlikely(count < sizeof(struct pi433_tx_cfg)))
814 return -EMSGSIZE;
815
> 816 tx_cfg = (struct pi433_tx_cfg *)buf;
817
818 if (unlikely(count != sizeof(struct pi433_tx_cfg)) + tx_cfg->payload_size)
819 return -EMSGSIZE;
820
821 /*
822 * write the following sequence into fifo:
823 * - tx_cfg
824 * - size of message
825 * - message
826 */
827 mutex_lock(&device->tx_fifo_lock);
828
829 available = kfifo_avail(&device->tx_fifo);
830 if (count > available) {
831 dev_dbg(device->dev, "write to fifo failed: %d bytes required but %d available\n",
832 required, available);
833 mutex_unlock(&device->tx_fifo_lock);
834 return -EAGAIN;
835 }
836
837 retval = kfifo_from_user(&device->tx_fifo, buf, count, &copied);
838 if (retval || copied != count)
839 goto abort;
840
841 mutex_unlock(&device->tx_fifo_lock);
842
843 /* start transfer */
844 wake_up_interruptible(&device->tx_wait_queue);
845 dev_dbg(device->dev, "write: generated new msg with %d bytes.\n", copied);
846
847 return copied;
848
849 abort:
850 dev_warn(device->dev,
851 "write to fifo failed, non recoverable: 0x%x\n", retval);
852 mutex_unlock(&device->tx_fifo_lock);
853 return -EAGAIN;
854 }
855
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists