[ls-zhu:get_dev_config_submit 5/5] drivers/vdpa/vdpa.c:823:20: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Mon Apr 11 2022 - 16:24:59 EST


tree: https://github.com/ls-zhu/linux get_dev_config_submit
head: c4a67f3ac1a9cc5a7bdc0121a9076c67a4f20af9
commit: c4a67f3ac1a9cc5a7bdc0121a9076c67a4f20af9 [5/5] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
config: m68k-randconfig-s031-20220411 (https://download.01.org/0day-ci/archive/20220412/202204120428.0TpzQuA8-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.2.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.4-dirty
# https://github.com/ls-zhu/linux/commit/c4a67f3ac1a9cc5a7bdc0121a9076c67a4f20af9
git remote add ls-zhu https://github.com/ls-zhu/linux
git fetch --no-tags ls-zhu get_dev_config_submit
git checkout c4a67f3ac1a9cc5a7bdc0121a9076c67a4f20af9
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash drivers/vdpa/

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/vdpa/vdpa.c:823:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] mq @@ got restricted __virtio16 const [usertype] max_virtqueue_pairs @@
drivers/vdpa/vdpa.c:823:20: sparse: expected unsigned short [assigned] [usertype] mq
drivers/vdpa/vdpa.c:823:20: sparse: got restricted __virtio16 const [usertype] max_virtqueue_pairs
drivers/vdpa/vdpa.c:825:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:825:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:825:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:825:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:842:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast from restricted __virtio16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast to restricted __le16
drivers/vdpa/vdpa.c:846:19: sparse: sparse: cast from restricted __virtio16

vim +823 drivers/vdpa/vdpa.c

813
814 static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
815 struct sk_buff *msg, u64 features,
816 const struct virtio_net_config *config)
817 {
818 u16 val_u16, mq;
819
820 if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0) {
821 mq = 1;
822 } else
> 823 mq = config->max_virtqueue_pairs;
824
825 val_u16 = le16_to_cpu(mq);
826
827 return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, val_u16);
828 }
829

--
0-DAY CI Kernel Test Service
https://01.org/lkp