drivers/hsi/clients/ssi_protocol.c:630:33: sparse: sparse: cast to restricted __be16

From: kernel test robot
Date: Wed Feb 10 2021 - 00:35:16 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e0756cfc7d7cd08c98a53b6009c091a3f6a50be6
commit: bbd7ffdbef6888459f301c5889f3b14ada38b913 clk: Allow the common clk framework to be selectable
date: 9 months ago
config: arm-randconfig-s032-20210209 (attached as .config)
compiler: arm-linux-gnueabi-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-215-g0fb77bb6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bbd7ffdbef6888459f301c5889f3b14ada38b913
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout bbd7ffdbef6888459f301c5889f3b14ada38b913
# 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=arm

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/hsi/clients/ssi_protocol.c:630:33: sparse: sparse: cast to restricted __be16
>> drivers/hsi/clients/ssi_protocol.c:630:33: sparse: sparse: cast to restricted __be16
>> drivers/hsi/clients/ssi_protocol.c:630:33: sparse: sparse: cast to restricted __be16
>> drivers/hsi/clients/ssi_protocol.c:630:33: sparse: sparse: cast to restricted __be16
drivers/hsi/clients/ssi_protocol.c:631:9: sparse: sparse: cast to restricted __be16
drivers/hsi/clients/ssi_protocol.c:631:9: sparse: sparse: cast to restricted __be16
drivers/hsi/clients/ssi_protocol.c:631:9: sparse: sparse: cast to restricted __be16
drivers/hsi/clients/ssi_protocol.c:631:9: sparse: sparse: cast to restricted __be16
>> drivers/hsi/clients/ssi_protocol.c:992:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __be16 [usertype] @@
drivers/hsi/clients/ssi_protocol.c:992:31: sparse: expected unsigned short [usertype]
drivers/hsi/clients/ssi_protocol.c:992:31: sparse: got restricted __be16 [usertype]

vim +630 drivers/hsi/clients/ssi_protocol.c

dc7bf5d7186849 Sebastian Reichel 2013-11-15 607
dc7bf5d7186849 Sebastian Reichel 2013-11-15 608 /* In soft IRQ context */
dc7bf5d7186849 Sebastian Reichel 2013-11-15 609 static void ssip_pn_rx(struct sk_buff *skb)
dc7bf5d7186849 Sebastian Reichel 2013-11-15 610 {
dc7bf5d7186849 Sebastian Reichel 2013-11-15 611 struct net_device *dev = skb->dev;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 612
dc7bf5d7186849 Sebastian Reichel 2013-11-15 613 if (unlikely(!netif_running(dev))) {
dc7bf5d7186849 Sebastian Reichel 2013-11-15 614 dev_dbg(&dev->dev, "Drop RX packet\n");
dc7bf5d7186849 Sebastian Reichel 2013-11-15 615 dev->stats.rx_dropped++;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 616 dev_kfree_skb(skb);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 617 return;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 618 }
dc7bf5d7186849 Sebastian Reichel 2013-11-15 619 if (unlikely(!pskb_may_pull(skb, SSIP_MIN_PN_HDR))) {
dc7bf5d7186849 Sebastian Reichel 2013-11-15 620 dev_dbg(&dev->dev, "Error drop RX packet\n");
dc7bf5d7186849 Sebastian Reichel 2013-11-15 621 dev->stats.rx_errors++;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 622 dev->stats.rx_length_errors++;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 623 dev_kfree_skb(skb);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 624 return;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 625 }
dc7bf5d7186849 Sebastian Reichel 2013-11-15 626 dev->stats.rx_packets++;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 627 dev->stats.rx_bytes += skb->len;
dc7bf5d7186849 Sebastian Reichel 2013-11-15 628
dc7bf5d7186849 Sebastian Reichel 2013-11-15 629 /* length field is exchanged in network byte order */
dc7bf5d7186849 Sebastian Reichel 2013-11-15 @630 ((u16 *)skb->data)[2] = ntohs(((u16 *)skb->data)[2]);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 631 dev_dbg(&dev->dev, "RX length fixed (%04x -> %u)\n",
dc7bf5d7186849 Sebastian Reichel 2013-11-15 632 ((u16 *)skb->data)[2], ntohs(((u16 *)skb->data)[2]));
dc7bf5d7186849 Sebastian Reichel 2013-11-15 633
dc7bf5d7186849 Sebastian Reichel 2013-11-15 634 skb->protocol = htons(ETH_P_PHONET);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 635 skb_reset_mac_header(skb);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 636 __skb_pull(skb, 1);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 637 netif_rx(skb);
dc7bf5d7186849 Sebastian Reichel 2013-11-15 638 }
dc7bf5d7186849 Sebastian Reichel 2013-11-15 639

:::::: The code at line 630 was first introduced by commit
:::::: dc7bf5d7186849aa36b9f0e42e250a813a7b0bdb HSI: Introduce driver for SSI Protocol

:::::: TO: Sebastian Reichel <sre@xxxxxxxxxx>
:::::: CC: Sebastian Reichel <sre@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip