drivers/md/dm-ioctl.c:1783:36: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Aug 18 2020 - 03:05:59 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 9 weeks ago
config: sh-randconfig-s031-20200818 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-180-g49f7e13a-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/md/dm-ioctl.c:1783:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __user *__cl_addr @@
drivers/md/dm-ioctl.c:1783:36: sparse: expected void *addr
>> drivers/md/dm-ioctl.c:1783:36: sparse: got void [noderef] __user *__cl_addr
drivers/md/dm-ioctl.c:1798:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __user *__cl_addr @@
drivers/md/dm-ioctl.c:1798:28: sparse: expected void *addr
drivers/md/dm-ioctl.c:1798:28: sparse: got void [noderef] __user *__cl_addr
--
drivers/hid/hidraw.c:389:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
drivers/hid/hidraw.c:389:37: sparse: expected int const *__gu_addr
drivers/hid/hidraw.c:389:37: sparse: got int [noderef] __user *
>> drivers/hid/hidraw.c:389:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> drivers/hid/hidraw.c:389:37: sparse: expected void const volatile [noderef] __user *
drivers/hid/hidraw.c:389:37: sparse: got int const *__gu_addr
--
kernel/bpf/cgroup.c:1402:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user *optlen @@
kernel/bpf/cgroup.c:1402:21: sparse: expected int const *__gu_addr
kernel/bpf/cgroup.c:1402:21: sparse: got int [noderef] __user *optlen
>> kernel/bpf/cgroup.c:1402:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> kernel/bpf/cgroup.c:1402:21: sparse: expected void const volatile [noderef] __user *
kernel/bpf/cgroup.c:1402:21: sparse: got int const *__gu_addr
--
fs/ext4/ioctl.c:609:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
fs/ext4/ioctl.c:609:13: sparse: expected unsigned int const *__gu_addr
fs/ext4/ioctl.c:609:13: sparse: got unsigned int [noderef] [usertype] __user *
>> fs/ext4/ioctl.c:609:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
>> fs/ext4/ioctl.c:609:13: sparse: expected void const volatile [noderef] __user *
fs/ext4/ioctl.c:609:13: sparse: got unsigned int const *__gu_addr
fs/ext4/ioctl.c:833:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/ext4/ioctl.c:833:21: sparse: expected int const *__gu_addr
fs/ext4/ioctl.c:833:21: sparse: got int [noderef] __user *
>> fs/ext4/ioctl.c:833:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
fs/ext4/ioctl.c:833:21: sparse: expected void const volatile [noderef] __user *
fs/ext4/ioctl.c:833:21: sparse: got int const *__gu_addr
fs/ext4/ioctl.c:884:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/ext4/ioctl.c:884:21: sparse: expected int const *__gu_addr
fs/ext4/ioctl.c:884:21: sparse: got int [noderef] __user *
fs/ext4/ioctl.c:884:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
fs/ext4/ioctl.c:884:21: sparse: expected void const volatile [noderef] __user *
fs/ext4/ioctl.c:884:21: sparse: got int const *__gu_addr
fs/ext4/ioctl.c:917:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
fs/ext4/ioctl.c:917:21: sparse: expected unsigned int const *__gu_addr
fs/ext4/ioctl.c:917:21: sparse: got unsigned int [noderef] [usertype] __user *
fs/ext4/ioctl.c:917:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
fs/ext4/ioctl.c:917:21: sparse: expected void const volatile [noderef] __user *
fs/ext4/ioctl.c:917:21: sparse: got unsigned int const *__gu_addr
--
fs/ext2/ioctl.c:47:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/ext2/ioctl.c:47:21: sparse: expected int const *__gu_addr
fs/ext2/ioctl.c:47:21: sparse: got int [noderef] __user *
>> fs/ext2/ioctl.c:47:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> fs/ext2/ioctl.c:47:21: sparse: expected void const volatile [noderef] __user *
fs/ext2/ioctl.c:47:21: sparse: got int const *__gu_addr
fs/ext2/ioctl.c:92:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/ext2/ioctl.c:92:21: sparse: expected int const *__gu_addr
fs/ext2/ioctl.c:92:21: sparse: got int [noderef] __user *
fs/ext2/ioctl.c:92:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
fs/ext2/ioctl.c:92:21: sparse: expected void const volatile [noderef] __user *
fs/ext2/ioctl.c:92:21: sparse: got int const *__gu_addr
fs/ext2/ioctl.c:123:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/ext2/ioctl.c:123:21: sparse: expected int const *__gu_addr
fs/ext2/ioctl.c:123:21: sparse: got int [noderef] __user *
fs/ext2/ioctl.c:123:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
fs/ext2/ioctl.c:123:21: sparse: expected void const volatile [noderef] __user *
fs/ext2/ioctl.c:123:21: sparse: got int const *__gu_addr
--
fs/fat/file.c:44:15: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user *user_attr @@
fs/fat/file.c:44:15: sparse: expected unsigned int const *__gu_addr
fs/fat/file.c:44:15: sparse: got unsigned int [noderef] [usertype] __user *user_attr
>> fs/fat/file.c:44:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
>> fs/fat/file.c:44:15: sparse: expected void const volatile [noderef] __user *
fs/fat/file.c:44:15: sparse: got unsigned int const *__gu_addr
--
fs/jfs/ioctl.c:83:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/jfs/ioctl.c:83:21: sparse: expected int const *__gu_addr
fs/jfs/ioctl.c:83:21: sparse: got int [noderef] __user *
>> fs/jfs/ioctl.c:83:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> fs/jfs/ioctl.c:83:21: sparse: expected void const volatile [noderef] __user *
fs/jfs/ioctl.c:83:21: sparse: got int const *__gu_addr
--
fs/xfs/xfs_ioctl.c:2249:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
fs/xfs/xfs_ioctl.c:2249:21: sparse: expected unsigned int const *__gu_addr
fs/xfs/xfs_ioctl.c:2249:21: sparse: got unsigned int [noderef] [usertype] __user *
>> fs/xfs/xfs_ioctl.c:2249:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
>> fs/xfs/xfs_ioctl.c:2249:21: sparse: expected void const volatile [noderef] __user *
fs/xfs/xfs_ioctl.c:2249:21: sparse: got unsigned int const *__gu_addr
--
fs/nilfs2/ioctl.c:138:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
fs/nilfs2/ioctl.c:138:13: sparse: expected int const *__gu_addr
fs/nilfs2/ioctl.c:138:13: sparse: got int [noderef] __user *
>> fs/nilfs2/ioctl.c:138:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> fs/nilfs2/ioctl.c:138:13: sparse: expected void const volatile [noderef] __user *
fs/nilfs2/ioctl.c:138:13: sparse: got int const *__gu_addr
--
net/bluetooth/hci_core.c:2090:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] [usertype] __user * @@
net/bluetooth/hci_core.c:2090:13: sparse: expected unsigned short const *__gu_addr
net/bluetooth/hci_core.c:2090:13: sparse: got unsigned short [noderef] [usertype] __user *
>> net/bluetooth/hci_core.c:2090:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned short const *__gu_addr @@
>> net/bluetooth/hci_core.c:2090:13: sparse: expected void const volatile [noderef] __user *
net/bluetooth/hci_core.c:2090:13: sparse: got unsigned short const *__gu_addr
--
drivers/input/mousedev.c:683:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char const [noderef] __user * @@
drivers/input/mousedev.c:683:21: sparse: expected char const *__gu_addr
drivers/input/mousedev.c:683:21: sparse: got char const [noderef] __user *
>> drivers/input/mousedev.c:683:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got char const *__gu_addr @@
>> drivers/input/mousedev.c:683:21: sparse: expected void const volatile [noderef] __user *
drivers/input/mousedev.c:683:21: sparse: got char const *__gu_addr
--
drivers/input/joydev.c:528:24: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected signed int const *__gu_addr @@ got signed int [noderef] [usertype] __user * @@
drivers/input/joydev.c:528:24: sparse: expected signed int const *__gu_addr
drivers/input/joydev.c:528:24: sparse: got signed int [noderef] [usertype] __user *
>> drivers/input/joydev.c:528:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got signed int const *__gu_addr @@
>> drivers/input/joydev.c:528:24: sparse: expected void const volatile [noderef] __user *
drivers/input/joydev.c:528:24: sparse: got signed int const *__gu_addr
drivers/input/joydev.c:680:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected long const *__gu_addr @@ got long [noderef] __user * @@
drivers/input/joydev.c:680:26: sparse: expected long const *__gu_addr
drivers/input/joydev.c:680:26: sparse: got long [noderef] __user *
>> drivers/input/joydev.c:680:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got long const *__gu_addr @@
drivers/input/joydev.c:680:26: sparse: expected void const volatile [noderef] __user *
drivers/input/joydev.c:680:26: sparse: got long const *__gu_addr
--
drivers/input/evdev.c:854:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
drivers/input/evdev.c:854:13: sparse: expected int const *__gu_addr
drivers/input/evdev.c:854:13: sparse: got int [noderef] __user *
>> drivers/input/evdev.c:854:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
>> drivers/input/evdev.c:854:13: sparse: expected void const volatile [noderef] __user *
drivers/input/evdev.c:854:13: sparse: got int const *__gu_addr
drivers/input/evdev.c:928:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
drivers/input/evdev.c:928:13: sparse: expected int const *__gu_addr
drivers/input/evdev.c:928:13: sparse: got int [noderef] __user *
drivers/input/evdev.c:928:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
drivers/input/evdev.c:928:13: sparse: expected void const volatile [noderef] __user *
drivers/input/evdev.c:928:13: sparse: got int const *__gu_addr
>> drivers/input/evdev.c:1023:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __user *__cl_addr @@
drivers/input/evdev.c:1023:21: sparse: expected void *addr
>> drivers/input/evdev.c:1023:21: sparse: got void [noderef] __user *__cl_addr
drivers/input/evdev.c:1066:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user *ip @@
drivers/input/evdev.c:1066:21: sparse: expected int const *__gu_addr
drivers/input/evdev.c:1066:21: sparse: got int [noderef] __user *ip
drivers/input/evdev.c:1066:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
drivers/input/evdev.c:1066:21: sparse: expected void const volatile [noderef] __user *
drivers/input/evdev.c:1066:21: sparse: got int const *__gu_addr
drivers/input/evdev.c:1068:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@
drivers/input/evdev.c:1068:21: sparse: expected int const *__gu_addr
drivers/input/evdev.c:1068:21: sparse: got int [noderef] __user *
drivers/input/evdev.c:1068:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got int const *__gu_addr @@
drivers/input/evdev.c:1068:21: sparse: expected void const volatile [noderef] __user *
drivers/input/evdev.c:1068:21: sparse: got int const *__gu_addr
--
net/phonet/datagram.c:47:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
net/phonet/datagram.c:47:29: sparse: expected unsigned int const *__gu_addr
net/phonet/datagram.c:47:29: sparse: got unsigned int [noderef] [usertype] __user *
>> net/phonet/datagram.c:47:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
>> net/phonet/datagram.c:47:29: sparse: expected void const volatile [noderef] __user *
net/phonet/datagram.c:47:29: sparse: got unsigned int const *__gu_addr
--
drivers/spi/spidev.c:396:34: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/spi/spidev.c:396:34: sparse: expected unsigned char const *__gu_addr
drivers/spi/spidev.c:396:34: sparse: got unsigned char [noderef] [usertype] __user *
>> drivers/spi/spidev.c:396:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned char const *__gu_addr @@
>> drivers/spi/spidev.c:396:34: sparse: expected void const volatile [noderef] __user *
drivers/spi/spidev.c:396:34: sparse: got unsigned char const *__gu_addr
drivers/spi/spidev.c:398:34: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/spi/spidev.c:398:34: sparse: expected unsigned int const *__gu_addr
drivers/spi/spidev.c:398:34: sparse: got unsigned int [noderef] [usertype] __user *
>> drivers/spi/spidev.c:398:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
drivers/spi/spidev.c:398:34: sparse: expected void const volatile [noderef] __user *
drivers/spi/spidev.c:398:34: sparse: got unsigned int const *__gu_addr
drivers/spi/spidev.c:422:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/spi/spidev.c:422:26: sparse: expected unsigned char const *__gu_addr
drivers/spi/spidev.c:422:26: sparse: got unsigned char [noderef] [usertype] __user *
drivers/spi/spidev.c:422:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned char const *__gu_addr @@
drivers/spi/spidev.c:422:26: sparse: expected void const volatile [noderef] __user *
drivers/spi/spidev.c:422:26: sparse: got unsigned char const *__gu_addr
drivers/spi/spidev.c:439:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/spi/spidev.c:439:26: sparse: expected unsigned char const *__gu_addr
drivers/spi/spidev.c:439:26: sparse: got unsigned char [noderef] [usertype] __user *
drivers/spi/spidev.c:439:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned char const *__gu_addr @@
drivers/spi/spidev.c:439:26: sparse: expected void const volatile [noderef] __user *
drivers/spi/spidev.c:439:26: sparse: got unsigned char const *__gu_addr
drivers/spi/spidev.c:452:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/spi/spidev.c:452:26: sparse: expected unsigned int const *__gu_addr
drivers/spi/spidev.c:452:26: sparse: got unsigned int [noderef] [usertype] __user *
drivers/spi/spidev.c:452:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user * @@ got unsigned int const *__gu_addr @@
drivers/spi/spidev.c:452:26: sparse: expected void const volatile [noderef] __user *
drivers/spi/spidev.c:452:26: sparse: got unsigned int const *__gu_addr

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +1783 drivers/md/dm-ioctl.c

9c5091f2eeeffe Mikulas Patocka 2012-12-21 1747
02cde50b7ea745 Mikulas Patocka 2013-03-01 1748 static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kernel,
800a7340ab7dd6 Wenwen Wang 2018-10-03 1749 int ioctl_flags, struct dm_ioctl **param, int *param_flags)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1750 {
02cde50b7ea745 Mikulas Patocka 2013-03-01 1751 struct dm_ioctl *dmi;
f868120549fc16 Milan Broz 2011-03-24 1752 int secure_data;
6080758d441acd Bart Van Assche 2016-11-18 1753 const size_t minimum_data_size = offsetof(struct dm_ioctl, data);
d224e938189771 Michal Hocko 2017-05-08 1754 unsigned noio_flag;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1755
02cde50b7ea745 Mikulas Patocka 2013-03-01 1756 if (copy_from_user(param_kernel, user, minimum_data_size))
^1da177e4c3f41 Linus Torvalds 2005-04-16 1757 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1758
02cde50b7ea745 Mikulas Patocka 2013-03-01 1759 if (param_kernel->data_size < minimum_data_size)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1760 return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1761
02cde50b7ea745 Mikulas Patocka 2013-03-01 1762 secure_data = param_kernel->flags & DM_SECURE_DATA_FLAG;
f868120549fc16 Milan Broz 2011-03-24 1763
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1764 *param_flags = secure_data ? DM_WIPE_BUFFER : 0;
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1765
02cde50b7ea745 Mikulas Patocka 2013-03-01 1766 if (ioctl_flags & IOCTL_FLAGS_NO_PARAMS) {
02cde50b7ea745 Mikulas Patocka 2013-03-01 1767 dmi = param_kernel;
02cde50b7ea745 Mikulas Patocka 2013-03-01 1768 dmi->data_size = minimum_data_size;
02cde50b7ea745 Mikulas Patocka 2013-03-01 1769 goto data_copied;
02cde50b7ea745 Mikulas Patocka 2013-03-01 1770 }
02cde50b7ea745 Mikulas Patocka 2013-03-01 1771
5023e5cf58e1da Mikulas Patocka 2012-12-21 1772 /*
8c1e2162f27b31 Junaid Shahid 2017-05-18 1773 * Use __GFP_HIGH to avoid low memory issues when a device is
8c1e2162f27b31 Junaid Shahid 2017-05-18 1774 * suspended and the ioctl is needed to resume it.
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1775 * Use kmalloc() rather than vmalloc() when we can.
5023e5cf58e1da Mikulas Patocka 2012-12-21 1776 */
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1777 dmi = NULL;
1c0e883e86ece3 Mikulas Patocka 2013-07-10 1778 noio_flag = memalloc_noio_save();
8c1e2162f27b31 Junaid Shahid 2017-05-18 1779 dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL | __GFP_HIGH);
1c0e883e86ece3 Mikulas Patocka 2013-07-10 1780 memalloc_noio_restore(noio_flag);
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1781
f868120549fc16 Milan Broz 2011-03-24 1782 if (!dmi) {
02cde50b7ea745 Mikulas Patocka 2013-03-01 @1783 if (secure_data && clear_user(user, param_kernel->data_size))
f868120549fc16 Milan Broz 2011-03-24 1784 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1785 return -ENOMEM;
f868120549fc16 Milan Broz 2011-03-24 1786 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1787
028b39e314dd8b Bart Van Assche 2016-06-28 1788 *param_flags |= DM_PARAMS_MALLOC;
028b39e314dd8b Bart Van Assche 2016-06-28 1789
800a7340ab7dd6 Wenwen Wang 2018-10-03 1790 /* Copy from param_kernel (which was already copied from user) */
800a7340ab7dd6 Wenwen Wang 2018-10-03 1791 memcpy(dmi, param_kernel, minimum_data_size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1792
800a7340ab7dd6 Wenwen Wang 2018-10-03 1793 if (copy_from_user(&dmi->data, (char __user *)user + minimum_data_size,
800a7340ab7dd6 Wenwen Wang 2018-10-03 1794 param_kernel->data_size - minimum_data_size))
e910d7ebecd1aa Alasdair G Kergon 2012-12-21 1795 goto bad;
800a7340ab7dd6 Wenwen Wang 2018-10-03 1796 data_copied:
f868120549fc16 Milan Broz 2011-03-24 1797 /* Wipe the user buffer so we do not return it to userspace */
02cde50b7ea745 Mikulas Patocka 2013-03-01 1798 if (secure_data && clear_user(user, param_kernel->data_size))
f868120549fc16 Milan Broz 2011-03-24 1799 goto bad;
f868120549fc16 Milan Broz 2011-03-24 1800
^1da177e4c3f41 Linus Torvalds 2005-04-16 1801 *param = dmi;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1802 return 0;
6bb43b5d1f54fb Milan Broz 2011-03-24 1803
6bb43b5d1f54fb Milan Broz 2011-03-24 1804 bad:
02cde50b7ea745 Mikulas Patocka 2013-03-01 1805 free_params(dmi, param_kernel->data_size, *param_flags);
9c5091f2eeeffe Mikulas Patocka 2012-12-21 1806
6bb43b5d1f54fb Milan Broz 2011-03-24 1807 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1808 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1809

:::::: The code at line 1783 was first introduced by commit
:::::: 02cde50b7ea74557d32ff778c73809322445ccd2 dm ioctl: optimize functions without variable params

:::::: TO: Mikulas Patocka <mpatocka@xxxxxxxxxx>
:::::: CC: Alasdair G Kergon <agk@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip