Re: [PATCH v14 8/8] soc: amd: Add support for AMD Pensando SoC Controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brad,

kernel test robot noticed the following build warnings:

[auto build test WARNING on e922ba281a8d84f640d8c8e18a385d032c19e185]

url:    https://github.com/intel-lab-lkp/linux/commits/Brad-Larson/dt-bindings-arm-add-AMD-Pensando-boards/20230516-032312
base:   e922ba281a8d84f640d8c8e18a385d032c19e185
patch link:    https://lore.kernel.org/r/20230515181606.65953-9-blarson%40amd.com
patch subject: [PATCH v14 8/8] soc: amd: Add support for AMD Pensando SoC Controller
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20230516/202305161642.PZQ4S8o2-lkp@xxxxxxxxx/config)
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/48a90df35083d2f3788e171ff0af01ddc8cd871b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Brad-Larson/dt-bindings-arm-add-AMD-Pensando-boards/20230516-032312
        git checkout 48a90df35083d2f3788e171ff0af01ddc8cd871b
        # 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 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/soc/amd/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305161642.PZQ4S8o2-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/soc/amd/pensando-ctrl.c: In function 'penctrl_ioctl':
>> drivers/soc/amd/pensando-ctrl.c:91:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      91 |         if (copy_from_user(tx_buf, (void __user *)msg->tx_buf, msg->len)) {
         |                                    ^
   drivers/soc/amd/pensando-ctrl.c:114:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     114 |         if (copy_to_user((void __user *)msg->rx_buf, rx_buf, msg->len))
         |                          ^


vim +91 drivers/soc/amd/pensando-ctrl.c

    34	
    35	static long
    36	penctrl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
    37	{
    38		void __user *in_arg = (void __user *)arg;
    39		struct penctrl_device *penctrl;
    40		u8 tx_buf[PENCTRL_MAX_MSG_LEN];
    41		u8 rx_buf[PENCTRL_MAX_MSG_LEN];
    42		struct spi_transfer t[2] = {};
    43		struct penctrl_spi_xfer *msg;
    44		struct spi_device *spi;
    45		unsigned int num_msgs;
    46		struct spi_message m;
    47		u32 size;
    48		int ret;
    49	
    50		/* Check for a valid command */
    51		if (_IOC_TYPE(cmd) != PENCTRL_IOC_MAGIC)
    52			return -ENOTTY;
    53	
    54		if (_IOC_NR(cmd) > PENCTRL_IOC_MAXNR)
    55			return -ENOTTY;
    56	
    57		if (((_IOC_DIR(cmd) & _IOC_READ)) && !access_ok(in_arg, _IOC_SIZE(cmd)))
    58			return -EFAULT;
    59	
    60		if (((_IOC_DIR(cmd) & _IOC_WRITE)) && !access_ok(in_arg, _IOC_SIZE(cmd)))
    61			return -EFAULT;
    62	
    63		/* Get a reference to the SPI device */
    64		penctrl = filp->private_data;
    65		if (!penctrl)
    66			return -ESHUTDOWN;
    67	
    68		spi = spi_dev_get(penctrl->spi);
    69		if (!spi)
    70			return -ESHUTDOWN;
    71	
    72		/* Verify and prepare SPI message */
    73		size = _IOC_SIZE(cmd);
    74		num_msgs = size / sizeof(struct penctrl_spi_xfer);
    75		if (num_msgs > 2 || size == 0 || size % sizeof(struct penctrl_spi_xfer)) {
    76			ret = -EINVAL;
    77			goto out_unlock;
    78		}
    79		msg = memdup_user((struct penctrl_spi_xfer *)arg, size);
    80		if (IS_ERR(msg)) {
    81			ret = PTR_ERR(msg);
    82			goto out_unlock;
    83		}
    84		if (msg->len > PENCTRL_MAX_MSG_LEN) {
    85			ret = -EINVAL;
    86			goto out_unlock;
    87		}
    88	
    89		t[0].tx_buf = tx_buf;
    90		t[0].len = msg->len;
  > 91		if (copy_from_user(tx_buf, (void __user *)msg->tx_buf, msg->len)) {
    92			ret = -EFAULT;
    93			goto out_unlock;
    94		}
    95		if (num_msgs > 1) {
    96			msg++;
    97			if (msg->len > PENCTRL_MAX_MSG_LEN) {
    98				ret = -EINVAL;
    99				goto out_unlock;
   100			}
   101			t[1].rx_buf = rx_buf;
   102			t[1].len = msg->len;
   103		}
   104		spi_message_init_with_transfers(&m, t, num_msgs);
   105	
   106		/* Perform the transfer */
   107		mutex_lock(&spi_lock);
   108		ret = spi_sync(spi, &m);
   109		mutex_unlock(&spi_lock);
   110	
   111		if (ret || (num_msgs == 1))
   112			goto out_unlock;
   113	
   114		if (copy_to_user((void __user *)msg->rx_buf, rx_buf, msg->len))
   115			ret = -EFAULT;
   116	
   117	out_unlock:
   118		spi_dev_put(spi);
   119		return ret;
   120	}
   121	

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



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux