public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Yaşar Arabacı" <yasar11732@gmail.com>, gregkh@linuxfoundation.org
Cc: kbuild-all@lists.01.org, paulo.miguel.almeida.rodenas@gmail.com,
	dan.carpenter@oracle.com, alexandre.belloni@bootlin.com,
	realwakka@gmail.com, u.kleine-koenig@pengutronix.de,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Yaşar Arabacı" <yasar11732@gmail.com>
Subject: Re: [PATCH] Staging: pi433: Don't use ioctl for per-client configuration
Date: Mon, 16 May 2022 23:30:36 +0800	[thread overview]
Message-ID: <202205162305.tBuUiz79-lkp@intel.com> (raw)
In-Reply-To: <20220515104711.94567-1-yasar11732@gmail.com>

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@intel.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

      parent reply	other threads:[~2022-05-16 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 10:47 [PATCH] Staging: pi433: Don't use ioctl for per-client configuration Yaşar Arabacı
2022-05-15 10:54 ` Greg KH
2022-05-15 10:55 ` Greg KH
2022-05-16  7:33 ` Dan Carpenter
2022-05-16 17:23   ` Yaşar Arabacı
2022-05-16 11:23 ` kernel test robot
2022-05-16 15:30 ` kernel test robot [this message]

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=202205162305.tBuUiz79-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paulo.miguel.almeida.rodenas@gmail.com \
    --cc=realwakka@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yasar11732@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox