lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202010230007.kRWofY6B-lkp@intel.com>
Date:   Fri, 23 Oct 2020 00:49:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Li Yang <leoyang.li@....com>, Timur Tabi <timur@...nel.org>
Subject: drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: sparse: incorrect
 type in assignment (different base types)

Hi Rasmus,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f804b3159482eedbb4250b1e9248c308fb63b805
commit: 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5 soc: fsl: qe: remove PPC32 dependency from CONFIG_QUICC_ENGINE
date:   11 months ago
config: powerpc64-randconfig-s031-20201022 (attached as .config)
compiler: powerpc64-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-17-g2d3af347-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5a35435ef4e6e4bd2aabd6706b146b298a9cffe5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5
        # 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=powerpc64 

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


"sparse warnings: (new ones prefixed by >>)"
   drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse:     expected void [noderef] <asn:2> *
   drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse:     got restricted __be16 *
   drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse:     expected void [noderef] <asn:2> *
   drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse:     got restricted __be32 *
   drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse:     expected void [noderef] <asn:2> *
   drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse:     got restricted __be16 *
   drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse:     expected void [noderef] <asn:2> *
   drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse:     got restricted __be32 *
>> drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] @@     got restricted __be16 [usertype] @@
   drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse:     expected unsigned short [usertype]
   drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse:     got restricted __be16 [usertype]
>> drivers/net/wan/fsl_ucc_hdlc.c:375:36: sparse: sparse: restricted __be16 degrades to integer
   drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct qe_bd [noderef] <asn:2> *bd @@     got struct qe_bd *curtx_bd @@
   drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse:     expected struct qe_bd [noderef] <asn:2> *bd
   drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse:     got struct qe_bd *curtx_bd
   drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct qe_bd [noderef] <asn:2> *[assigned] bd @@     got struct qe_bd *tx_bd_base @@
   drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse:     expected struct qe_bd [noderef] <asn:2> *[assigned] bd
   drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse:     got struct qe_bd *tx_bd_base
>> drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse:    struct qe_bd [noderef] <asn:2> *
>> drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse:    struct qe_bd *
   drivers/net/wan/fsl_ucc_hdlc.c:458:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:502:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:524:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:548:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:592:67: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:607:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:852:38: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct qe_mux *qe_mux_reg @@     got struct qe_mux [noderef] <asn:2> * @@
   drivers/net/wan/fsl_ucc_hdlc.c:855:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:856:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:859:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:862:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] <asn:2> *s @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:867:38: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct qe_mux *qe_mux_reg @@     got struct qe_mux [noderef] <asn:2> * @@
   drivers/net/wan/fsl_ucc_hdlc.c:869:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] <asn:2> *d @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:871:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:872:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:874:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:996:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:998:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:1007:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be16 * @@
   drivers/net/wan/fsl_ucc_hdlc.c:1009:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] <asn:2> * @@     got restricted __be32 * @@
>> drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
>> drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
   drivers/net/wan/fsl_ucc_hdlc.c:725:29: sparse: sparse: dereference of noderef expression
   drivers/net/wan/fsl_ucc_hdlc.c:816:21: sparse: sparse: dereference of noderef expression
   drivers/net/wan/fsl_ucc_hdlc.c:1024:29: sparse: sparse: dereference of noderef expression

vim +368 drivers/net/wan/fsl_ucc_hdlc.c

c19b6d246a3562 Zhao Qiang     2016-06-06  346  
c19b6d246a3562 Zhao Qiang     2016-06-06  347  static netdev_tx_t ucc_hdlc_tx(struct sk_buff *skb, struct net_device *dev)
c19b6d246a3562 Zhao Qiang     2016-06-06  348  {
c19b6d246a3562 Zhao Qiang     2016-06-06  349  	hdlc_device *hdlc = dev_to_hdlc(dev);
c19b6d246a3562 Zhao Qiang     2016-06-06  350  	struct ucc_hdlc_private *priv = (struct ucc_hdlc_private *)hdlc->priv;
c19b6d246a3562 Zhao Qiang     2016-06-06  351  	struct qe_bd __iomem *bd;
c19b6d246a3562 Zhao Qiang     2016-06-06  352  	u16 bd_status;
c19b6d246a3562 Zhao Qiang     2016-06-06  353  	unsigned long flags;
c19b6d246a3562 Zhao Qiang     2016-06-06  354  	u16 *proto_head;
c19b6d246a3562 Zhao Qiang     2016-06-06  355  
c19b6d246a3562 Zhao Qiang     2016-06-06  356  	switch (dev->type) {
c19b6d246a3562 Zhao Qiang     2016-06-06  357  	case ARPHRD_RAWHDLC:
c19b6d246a3562 Zhao Qiang     2016-06-06  358  		if (skb_headroom(skb) < HDLC_HEAD_LEN) {
c19b6d246a3562 Zhao Qiang     2016-06-06  359  			dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang     2016-06-06  360  			dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang     2016-06-06  361  			netdev_err(dev, "No enough space for hdlc head\n");
c19b6d246a3562 Zhao Qiang     2016-06-06  362  			return -ENOMEM;
c19b6d246a3562 Zhao Qiang     2016-06-06  363  		}
c19b6d246a3562 Zhao Qiang     2016-06-06  364  
c19b6d246a3562 Zhao Qiang     2016-06-06  365  		skb_push(skb, HDLC_HEAD_LEN);
c19b6d246a3562 Zhao Qiang     2016-06-06  366  
c19b6d246a3562 Zhao Qiang     2016-06-06  367  		proto_head = (u16 *)skb->data;
c19b6d246a3562 Zhao Qiang     2016-06-06 @368  		*proto_head = htons(DEFAULT_HDLC_HEAD);
c19b6d246a3562 Zhao Qiang     2016-06-06  369  
c19b6d246a3562 Zhao Qiang     2016-06-06  370  		dev->stats.tx_bytes += skb->len;
c19b6d246a3562 Zhao Qiang     2016-06-06  371  		break;
c19b6d246a3562 Zhao Qiang     2016-06-06  372  
c19b6d246a3562 Zhao Qiang     2016-06-06  373  	case ARPHRD_PPP:
c19b6d246a3562 Zhao Qiang     2016-06-06  374  		proto_head = (u16 *)skb->data;
c19b6d246a3562 Zhao Qiang     2016-06-06 @375  		if (*proto_head != htons(DEFAULT_PPP_HEAD)) {
c19b6d246a3562 Zhao Qiang     2016-06-06  376  			dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang     2016-06-06  377  			dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang     2016-06-06  378  			netdev_err(dev, "Wrong ppp header\n");
c19b6d246a3562 Zhao Qiang     2016-06-06  379  			return -ENOMEM;
c19b6d246a3562 Zhao Qiang     2016-06-06  380  		}
c19b6d246a3562 Zhao Qiang     2016-06-06  381  
c19b6d246a3562 Zhao Qiang     2016-06-06  382  		dev->stats.tx_bytes += skb->len;
c19b6d246a3562 Zhao Qiang     2016-06-06  383  		break;
c19b6d246a3562 Zhao Qiang     2016-06-06  384  
8978ca7c8b7b07 David Gounaris 2018-09-03  385  	case ARPHRD_ETHER:
8978ca7c8b7b07 David Gounaris 2018-09-03  386  		dev->stats.tx_bytes += skb->len;
8978ca7c8b7b07 David Gounaris 2018-09-03  387  		break;
8978ca7c8b7b07 David Gounaris 2018-09-03  388  
c19b6d246a3562 Zhao Qiang     2016-06-06  389  	default:
c19b6d246a3562 Zhao Qiang     2016-06-06  390  		dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang     2016-06-06  391  		dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang     2016-06-06  392  		return -ENOMEM;
c19b6d246a3562 Zhao Qiang     2016-06-06  393  	}
2e7ad56aa54778 Mathias Thore  2018-11-07  394  	netdev_sent_queue(dev, skb->len);
c19b6d246a3562 Zhao Qiang     2016-06-06  395  	spin_lock_irqsave(&priv->lock, flags);
c19b6d246a3562 Zhao Qiang     2016-06-06  396  
c19b6d246a3562 Zhao Qiang     2016-06-06  397  	/* Start from the next BD that should be filled */
c19b6d246a3562 Zhao Qiang     2016-06-06  398  	bd = priv->curtx_bd;
c19b6d246a3562 Zhao Qiang     2016-06-06  399  	bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang     2016-06-06  400  	/* Save the skb pointer so we can free it later */
c19b6d246a3562 Zhao Qiang     2016-06-06  401  	priv->tx_skbuff[priv->skb_curtx] = skb;
c19b6d246a3562 Zhao Qiang     2016-06-06  402  
c19b6d246a3562 Zhao Qiang     2016-06-06  403  	/* Update the current skb pointer (wrapping if this was the last) */
c19b6d246a3562 Zhao Qiang     2016-06-06  404  	priv->skb_curtx =
c19b6d246a3562 Zhao Qiang     2016-06-06  405  	    (priv->skb_curtx + 1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
c19b6d246a3562 Zhao Qiang     2016-06-06  406  
c19b6d246a3562 Zhao Qiang     2016-06-06  407  	/* copy skb data to tx buffer for sdma processing */
c19b6d246a3562 Zhao Qiang     2016-06-06 @408  	memcpy(priv->tx_buffer + (be32_to_cpu(bd->buf) - priv->dma_tx_addr),
c19b6d246a3562 Zhao Qiang     2016-06-06  409  	       skb->data, skb->len);
c19b6d246a3562 Zhao Qiang     2016-06-06  410  
c19b6d246a3562 Zhao Qiang     2016-06-06  411  	/* set bd status and length */
c19b6d246a3562 Zhao Qiang     2016-06-06  412  	bd_status = (bd_status & T_W_S) | T_R_S | T_I_S | T_L_S | T_TC_S;
c19b6d246a3562 Zhao Qiang     2016-06-06  413  
c19b6d246a3562 Zhao Qiang     2016-06-06  414  	iowrite16be(skb->len, &bd->length);
02bb56ddc67116 Zhao Qiang     2017-03-14  415  	iowrite16be(bd_status, &bd->status);
c19b6d246a3562 Zhao Qiang     2016-06-06  416  
c19b6d246a3562 Zhao Qiang     2016-06-06  417  	/* Move to next BD in the ring */
c19b6d246a3562 Zhao Qiang     2016-06-06  418  	if (!(bd_status & T_W_S))
c19b6d246a3562 Zhao Qiang     2016-06-06  419  		bd += 1;
c19b6d246a3562 Zhao Qiang     2016-06-06  420  	else
c19b6d246a3562 Zhao Qiang     2016-06-06  421  		bd = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang     2016-06-06  422  
c19b6d246a3562 Zhao Qiang     2016-06-06 @423  	if (bd == priv->dirty_tx) {
c19b6d246a3562 Zhao Qiang     2016-06-06  424  		if (!netif_queue_stopped(dev))
c19b6d246a3562 Zhao Qiang     2016-06-06  425  			netif_stop_queue(dev);
c19b6d246a3562 Zhao Qiang     2016-06-06  426  	}
c19b6d246a3562 Zhao Qiang     2016-06-06  427  
c19b6d246a3562 Zhao Qiang     2016-06-06  428  	priv->curtx_bd = bd;
c19b6d246a3562 Zhao Qiang     2016-06-06  429  
c19b6d246a3562 Zhao Qiang     2016-06-06  430  	spin_unlock_irqrestore(&priv->lock, flags);
c19b6d246a3562 Zhao Qiang     2016-06-06  431  
c19b6d246a3562 Zhao Qiang     2016-06-06  432  	return NETDEV_TX_OK;
c19b6d246a3562 Zhao Qiang     2016-06-06  433  }
c19b6d246a3562 Zhao Qiang     2016-06-06  434  

:::::: The code at line 368 was first introduced by commit
:::::: c19b6d246a35627c3a69b2fa6bdece212b48214b drivers/net: support hdlc function for QE-UCC

:::::: TO: Zhao Qiang <qiang.zhao@....com>
:::::: CC: David S. Miller <davem@...emloft.net>

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

Download attachment ".config.gz" of type "application/gzip" (29503 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ