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: <202303061526.I8VPcR1M-lkp@intel.com>
Date:   Mon, 6 Mar 2023 15:41:25 +0800
From:   kernel test robot <lkp@...el.com>
To:     Brad Larson <blarson@....com>, linux-arm-kernel@...ts.infradead.org
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        linux-mmc@...r.kernel.org, linux-spi@...r.kernel.org,
        adrian.hunter@...el.com, alcooperx@...il.com,
        andy.shevchenko@...il.com, arnd@...db.de, blarson@....com,
        brendan.higgins@...ux.dev, briannorris@...omium.org,
        brijeshkumar.singh@....com, catalin.marinas@....com,
        davidgow@...gle.com, gsomlo@...il.com, gerg@...ux-m68k.org,
        krzk@...nel.org, krzysztof.kozlowski+dt@...aro.org, lee@...nel.org,
        lee.jones@...aro.org, broonie@...nel.org,
        yamada.masahiro@...ionext.com, p.zabel@...gutronix.de,
        piotrs@...ence.com, p.yadav@...com, rdunlap@...radead.org,
        robh+dt@...nel.org, samuel@...lland.org, fancer.lancer@...il.com,
        skhan@...uxfoundation.org
Subject: Re: [PATCH v10 15/15] soc: amd: Add support for AMD Pensando SoC
 Controller

Hi Brad,

I love your patch! Perhaps something to improve:

[auto build test WARNING on fe15c26ee26efa11741a7b632e9f23b01aca4cc6]

url:    https://github.com/intel-lab-lkp/linux/commits/Brad-Larson/dt-bindings-arm-add-AMD-Pensando-boards/20230306-121545
base:   fe15c26ee26efa11741a7b632e9f23b01aca4cc6
patch link:    https://lore.kernel.org/r/20230306040739.51488-16-blarson%40amd.com
patch subject: [PATCH v10 15/15] soc: amd: Add support for AMD Pensando SoC Controller
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20230306/202303061526.I8VPcR1M-lkp@intel.com/config)
compiler: m68k-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/b4bbd78c769f6618e07ec1607fdd3d964dd13083
        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/20230306-121545
        git checkout b4bbd78c769f6618e07ec1607fdd3d964dd13083
        # 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=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/soc/amd/

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

All warnings (new ones prefixed by >>):

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


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

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ