drivers/net/usb/lan78xx.c:2963:27: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Tue Nov 23 2021 - 15:27:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: sparse can do constant folding of __builtin_bswap*()
date: 7 months ago
config: i386-randconfig-s002-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240417.62gcvdWw-lkp@xxxxxxxxx/config.gz)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-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 config file to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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/usb/lan78xx.c:2963:29: sparse: sparse: cast to restricted __be16
>> drivers/net/usb/lan78xx.c:2963:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got unsigned short [usertype] @@
drivers/net/usb/lan78xx.c:2963:27: sparse: expected restricted __wsum [usertype] csum
drivers/net/usb/lan78xx.c:2963:27: sparse: got unsigned short [usertype]

vim +2963 drivers/net/usb/lan78xx.c

55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2949
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2950 static void lan78xx_rx_csum_offload(struct lan78xx_net *dev,
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2951 struct sk_buff *skb,
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2952 u32 rx_cmd_a, u32 rx_cmd_b)
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2953 {
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2954 /* HW Checksum offload appears to be flawed if used when not stripping
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2955 * VLAN headers. Drop back to S/W checksums under these conditions.
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2956 */
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2957 if (!(dev->net->features & NETIF_F_RXCSUM) ||
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2958 unlikely(rx_cmd_a & RX_CMD_A_ICSM_) ||
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2959 ((rx_cmd_a & RX_CMD_A_FVTG_) &&
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2960 !(dev->net->features & NETIF_F_HW_VLAN_CTAG_RX))) {
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2961 skb->ip_summed = CHECKSUM_NONE;
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2962 } else {
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 @2963 skb->csum = ntohs((u16)(rx_cmd_b >> RX_CMD_B_CSUM_SHIFT_));
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2964 skb->ip_summed = CHECKSUM_COMPLETE;
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2965 }
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2966 }
55d7de9de6c30a Woojung.Huh@xxxxxxxxxxxxx 2015-07-30 2967

:::::: The code at line 2963 was first introduced by commit
:::::: 55d7de9de6c30adce8d675c7ce513e283829c2ff Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver

:::::: TO: Woojung.Huh@xxxxxxxxxxxxx <Woojung.Huh@xxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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