drivers/net/vmxnet3/vmxnet3_drv.c:228:23: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Mon May 10 2021 - 10:11:45 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6efb943b8616ec53a5e444193dccf1af9ad627b5
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: sparse can do constant folding of __builtin_bswap*()
date: 10 days ago
config: powerpc-randconfig-s032-20210510 (attached as .config)
compiler: powerpc-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.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d991bb1c8da842a2a0b9dc83b1005e655783f861
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d991bb1c8da842a2a0b9dc83b1005e655783f861
# 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__' W=1 ARCH=powerpc

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/net/vmxnet3/vmxnet3_drv.c:228:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le64 [usertype] addr @@ got unsigned long long [usertype] @@
drivers/net/vmxnet3/vmxnet3_drv.c:228:23: sparse: expected restricted __le64 [usertype] addr
drivers/net/vmxnet3/vmxnet3_drv.c:228:23: sparse: got unsigned long long [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:229:16: sparse: sparse: cast to restricted __le32
drivers/net/vmxnet3/vmxnet3_drv.c:230:25: sparse: sparse: cast to restricted __le32
drivers/net/vmxnet3/vmxnet3_drv.c:244:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/net/vmxnet3/vmxnet3_drv.c:244:22: sparse: expected unsigned int [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:244:22: sparse: got restricted __le32 [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:256:24: sparse: sparse: cast to restricted __le32
drivers/net/vmxnet3/vmxnet3_drv.c:1248:43: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got restricted __be16 [usertype] @@
drivers/net/vmxnet3/vmxnet3_drv.c:1248:43: sparse: expected restricted __wsum [usertype] csum
drivers/net/vmxnet3/vmxnet3_drv.c:1248:43: sparse: got restricted __be16 [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:1390:17: sparse: sparse: restricted __le64 degrades to integer
drivers/net/vmxnet3/vmxnet3_drv.c:1390:17: sparse: sparse: restricted __le64 degrades to integer
drivers/net/vmxnet3/vmxnet3_drv.c:1390:17: sparse: sparse: restricted __le64 degrades to integer
drivers/net/vmxnet3/vmxnet3_drv.c:1661:33: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] addr @@ got restricted __le64 [usertype] addr @@
drivers/net/vmxnet3/vmxnet3_drv.c:1661:33: sparse: expected unsigned int [usertype] addr
drivers/net/vmxnet3/vmxnet3_drv.c:1661:33: sparse: got restricted __le64 [usertype] addr
drivers/net/vmxnet3/vmxnet3_drv.c:1667:33: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] addr @@ got restricted __le64 [usertype] addr @@
drivers/net/vmxnet3/vmxnet3_drv.c:1667:33: sparse: expected unsigned int [usertype] addr
drivers/net/vmxnet3/vmxnet3_drv.c:1667:33: sparse: got restricted __le64 [usertype] addr
drivers/net/vmxnet3/vmxnet3_drv.c:2289:31: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] *vfTable @@ got restricted __le32 * @@
drivers/net/vmxnet3/vmxnet3_drv.c:2289:31: sparse: expected unsigned int [usertype] *vfTable
drivers/net/vmxnet3/vmxnet3_drv.c:2289:31: sparse: got restricted __le32 *
drivers/net/vmxnet3/vmxnet3_drv.c:2306:39: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] *vfTable @@ got restricted __le32 * @@
drivers/net/vmxnet3/vmxnet3_drv.c:2306:39: sparse: expected unsigned int [usertype] *vfTable
drivers/net/vmxnet3/vmxnet3_drv.c:2306:39: sparse: got restricted __le32 *
drivers/net/vmxnet3/vmxnet3_drv.c:2328:39: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] *vfTable @@ got restricted __le32 * @@
drivers/net/vmxnet3/vmxnet3_drv.c:2328:39: sparse: expected unsigned int [usertype] *vfTable
drivers/net/vmxnet3/vmxnet3_drv.c:2328:39: sparse: got restricted __le32 *
drivers/net/vmxnet3/vmxnet3_drv.c:2380:39: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] *vfTable @@ got restricted __le32 * @@
drivers/net/vmxnet3/vmxnet3_drv.c:2380:39: sparse: expected unsigned int [usertype] *vfTable
drivers/net/vmxnet3/vmxnet3_drv.c:2380:39: sparse: got restricted __le32 *
drivers/net/vmxnet3/vmxnet3_drv.c:2426:31: sparse: sparse: restricted __le32 degrades to integer
drivers/net/vmxnet3/vmxnet3_drv.c:2439:17: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] size @@ got restricted __le16 [usertype] mfTableLen @@
drivers/net/vmxnet3/vmxnet3_drv.c:2439:17: sparse: expected unsigned int [usertype] size
drivers/net/vmxnet3/vmxnet3_drv.c:2439:17: sparse: got restricted __le16 [usertype] mfTableLen
drivers/net/vmxnet3/vmxnet3_drv.c:2476:49: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/net/vmxnet3/vmxnet3_drv.c:2476:49: sparse: expected unsigned int [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:2476:49: sparse: got restricted __le32 [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:2517:41: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] txDataRingDescSize @@ got restricted __le32 [usertype] @@
drivers/net/vmxnet3/vmxnet3_drv.c:2517:41: sparse: expected restricted __le16 [usertype] txDataRingDescSize
drivers/net/vmxnet3/vmxnet3_drv.c:2517:41: sparse: got restricted __le32 [usertype]
drivers/net/vmxnet3/vmxnet3_drv.c:2566:46: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] confVer @@ got int @@
drivers/net/vmxnet3/vmxnet3_drv.c:2566:46: sparse: expected restricted __le32 [usertype] confVer
drivers/net/vmxnet3/vmxnet3_drv.c:2566:46: sparse: got int
drivers/net/vmxnet3/vmxnet3_drv.c:2603:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] confVer @@ got int @@
drivers/net/vmxnet3/vmxnet3_drv.c:2603:34: sparse: expected restricted __le32 [usertype] confVer
drivers/net/vmxnet3/vmxnet3_drv.c:2603:34: sparse: got int

vim +228 drivers/net/vmxnet3/vmxnet3_drv.c

d1a890fa37f27d Shreyas Bhatewara 2009-10-13 209
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 210 #ifdef __BIG_ENDIAN_BITFIELD
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 211 /*
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 212 * The device expects the bitfields in shared structures to be written in
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 213 * little endian. When CPU is big endian, the following routines are used to
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 214 * correctly read and write into ABI.
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 215 * The general technique used here is : double word bitfields are defined in
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 216 * opposite order for big endian architecture. Then before reading them in
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 217 * driver the complete double word is translated using le32_to_cpu. Similarly
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 218 * After the driver writes into bitfields, cpu_to_le32 is used to translate the
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 219 * double words into required format.
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 220 * In order to avoid touching bits in shared structure more than once, temporary
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 221 * descriptors are used. These are passed as srcDesc to following functions.
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 222 */
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 223 static void vmxnet3_RxDescToCPU(const struct Vmxnet3_RxDesc *srcDesc,
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 224 struct Vmxnet3_RxDesc *dstDesc)
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 225 {
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 226 u32 *src = (u32 *)srcDesc + 2;
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 227 u32 *dst = (u32 *)dstDesc + 2;
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 @228 dstDesc->addr = le64_to_cpu(srcDesc->addr);
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 229 *dst = le32_to_cpu(*src);
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 230 dstDesc->ext1 = le32_to_cpu(srcDesc->ext1);
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 231 }
115924b6bdc7cc Shreyas Bhatewara 2009-11-16 232

:::::: The code at line 228 was first introduced by commit
:::::: 115924b6bdc7cc6bf7da5b933b09281e1f4e17a9 net: Getting rid of the x86 dependency to built vmxnet3

:::::: TO: Shreyas Bhatewara <sbhatewara@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip