mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: kbuild-all@01.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Marcus Wolf <linux@wolf-entwicklungen.de>,
	linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	kernelnewbies@kernelnewbies.org
Subject: Re: [PATCH v3] staging: pi433: fix race condition in pi433_ioctl
Date: Thu, 14 Jun 2018 13:12:29 +0800	[thread overview]
Message-ID: <201806140913.Gd9lGmBy%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180614005414.GA1974@hle-laptop.local>

[-- Attachment #1: Type: text/plain, Size: 3323 bytes --]

Hi Hugo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.17 next-20180613]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Hugo-Lefeuvre/staging-pi433-fix-race-condition-in-pi433_ioctl/20180614-091011
config: x86_64-randconfig-x018-201823 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/staging/pi433/pi433_if.c: In function 'pi433_ioctl':
>> drivers/staging/pi433/pi433_if.c:909:30: error: 'tx_cfg_buffer' undeclared (first use in this function); did you mean 'sg_copy_buffer'?
      memcpy(&instance->tx_cfg, &tx_cfg_buffer, sizeof(struct pi433_tx_cfg));
                                 ^~~~~~~~~~~~~
                                 sg_copy_buffer
   drivers/staging/pi433/pi433_if.c:909:30: note: each undeclared identifier is reported only once for each function it appears in

vim +909 drivers/staging/pi433/pi433_if.c

   876	
   877	static long
   878	pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
   879	{
   880		int			retval = 0;
   881		struct pi433_instance	*instance;
   882		struct pi433_device	*device;
   883		struct pi433_tx_cfg	tx_cfg;
   884		void __user *argp = (void __user *)arg;
   885	
   886		/* Check type and command number */
   887		if (_IOC_TYPE(cmd) != PI433_IOC_MAGIC)
   888			return -ENOTTY;
   889	
   890		/* TODO? guard against device removal before, or while,
   891		 * we issue this ioctl. --> device_get()
   892		 */
   893		instance = filp->private_data;
   894		device = instance->device;
   895	
   896		if (!device)
   897			return -ESHUTDOWN;
   898	
   899		switch (cmd) {
   900		case PI433_IOC_RD_TX_CFG:
   901			if (copy_to_user(argp, &instance->tx_cfg,
   902					 sizeof(struct pi433_tx_cfg)))
   903				return -EFAULT;
   904			break;
   905		case PI433_IOC_WR_TX_CFG:
   906			if (copy_from_user(&tx_cfg, argp, sizeof(struct pi433_tx_cfg)))
   907				return -EFAULT;
   908			mutex_lock(&device->tx_fifo_lock);
 > 909			memcpy(&instance->tx_cfg, &tx_cfg_buffer, sizeof(struct pi433_tx_cfg));
   910			mutex_unlock(&device->tx_fifo_lock);
   911			break;
   912		case PI433_IOC_RD_RX_CFG:
   913			if (copy_to_user(argp, &device->rx_cfg,
   914					 sizeof(struct pi433_rx_cfg)))
   915				return -EFAULT;
   916			break;
   917		case PI433_IOC_WR_RX_CFG:
   918			mutex_lock(&device->rx_lock);
   919	
   920			/* during pendig read request, change of config not allowed */
   921			if (device->rx_active) {
   922				mutex_unlock(&device->rx_lock);
   923				return -EAGAIN;
   924			}
   925	
   926			if (copy_from_user(&device->rx_cfg, argp,
   927					   sizeof(struct pi433_rx_cfg))) {
   928				mutex_unlock(&device->rx_lock);
   929				return -EFAULT;
   930			}
   931	
   932			mutex_unlock(&device->rx_lock);
   933			break;
   934		default:
   935			retval = -EINVAL;
   936		}
   937	
   938		return retval;
   939	}
   940	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30137 bytes --]

  parent reply	other threads:[~2018-06-14  5:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14  0:54 Hugo Lefeuvre
2018-06-14  5:12 ` kbuild test robot
2018-06-14  5:12 ` kbuild test robot [this message]
2018-06-14 13:28   ` Hugo Lefeuvre

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=201806140913.Gd9lGmBy%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hle@owl.eu.com \
    --cc=kbuild-all@01.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@wolf-entwicklungen.de \
    /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

all inboxes | Powered by JetHome®