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: <202210110935.tritfaYN-lkp@intel.com>
Date:   Tue, 11 Oct 2022 09:21:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stafford Horne <shorne@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/message/fusion/mptlan.c:1177:21: sparse: sparse: cast to
 restricted __le16

Hi Stafford,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e2302539dd4f1c62d96651c07ddb05aa2461d29c
commit: ded2ee36313c941f1a12b6f85cde295b575264ae openrisc: Add pci bus support
date:   2 months ago
config: openrisc-randconfig-s053-20221010
compiler: or1k-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ded2ee36313c941f1a12b6f85cde295b575264ae
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout ded2ee36313c941f1a12b6f85cde295b575264ae
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash

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

sparse warnings: (new ones prefixed by >>)
>> drivers/message/fusion/mptlan.c:1177:21: sparse: sparse: cast to restricted __le16
>> drivers/message/fusion/mptlan.c:1177:21: sparse: sparse: cast to restricted __le16
>> drivers/message/fusion/mptlan.c:1177:21: sparse: sparse: cast to restricted __le16
>> drivers/message/fusion/mptlan.c:1177:21: sparse: sparse: cast to restricted __le16
>> drivers/message/fusion/mptlan.c:1240:52: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] TransactionContext @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:1240:52: sparse:     expected unsigned int [usertype] TransactionContext
   drivers/message/fusion/mptlan.c:1240:52: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:1244:46: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] FlagsLength @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:1244:46: sparse:     expected unsigned int [usertype] FlagsLength
   drivers/message/fusion/mptlan.c:1244:46: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:1248:46: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] Low @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:1248:46: sparse:     expected unsigned int [usertype] Low
   drivers/message/fusion/mptlan.c:1248:46: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:1250:55: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] High @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:1250:55: sparse:     expected unsigned int [usertype] High
   drivers/message/fusion/mptlan.c:1250:55: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:1264:38: sparse: sparse: invalid assignment: |=
>> drivers/message/fusion/mptlan.c:1264:38: sparse:    left side has type unsigned int
>> drivers/message/fusion/mptlan.c:1264:38: sparse:    right side has type restricted __le32
>> drivers/message/fusion/mptlan.c:1266:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] BucketCount @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:1266:39: sparse:     expected unsigned int [usertype] BucketCount
   drivers/message/fusion/mptlan.c:1266:39: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:969:25: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:974:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:974:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:974:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:974:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:977:14: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:977:14: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:977:14: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:977:14: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:981:15: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:986:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:986:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:986:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:986:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:991:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:995:18: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:1025:31: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:612:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:612:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:612:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:612:9: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:617:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:617:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:617:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:617:17: sparse: sparse: cast to restricted __le16
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:641:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:346:17: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:1498:27: sparse: sparse: restricted __be16 degrades to integer
>> drivers/message/fusion/mptlan.c:1535:29: sparse: sparse: incorrect type in return expression (different base types) @@     expected unsigned short @@     got restricted __be16 [usertype] ethertype @@
   drivers/message/fusion/mptlan.c:1535:29: sparse:     expected unsigned short
   drivers/message/fusion/mptlan.c:1535:29: sparse:     got restricted __be16 [usertype] ethertype
>> drivers/message/fusion/mptlan.c:1538:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected unsigned short @@     got restricted __be16 [usertype] @@
   drivers/message/fusion/mptlan.c:1538:16: sparse:     expected unsigned short
   drivers/message/fusion/mptlan.c:1538:16: sparse:     got restricted __be16 [usertype]
   drivers/message/fusion/mptlan.c:746:36: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] TransactionContext @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:746:36: sparse:     expected unsigned int [usertype] TransactionContext
   drivers/message/fusion/mptlan.c:746:36: sparse:     got restricted __le32 [usertype]
>> drivers/message/fusion/mptlan.c:754:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:754:39: sparse:     expected unsigned int
   drivers/message/fusion/mptlan.c:754:39: sparse:     got restricted __le32 [usertype]
   drivers/message/fusion/mptlan.c:757:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:757:39: sparse:     expected unsigned int
   drivers/message/fusion/mptlan.c:757:39: sparse:     got restricted __le32 [usertype]
   drivers/message/fusion/mptlan.c:767:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] FlagsLength @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:767:30: sparse:     expected unsigned int [usertype] FlagsLength
   drivers/message/fusion/mptlan.c:767:30: sparse:     got restricted __le32 [usertype]
   drivers/message/fusion/mptlan.c:776:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] Low @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:776:30: sparse:     expected unsigned int [usertype] Low
   drivers/message/fusion/mptlan.c:776:30: sparse:     got restricted __le32 [usertype]
   drivers/message/fusion/mptlan.c:778:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] High @@     got restricted __le32 [usertype] @@
   drivers/message/fusion/mptlan.c:778:39: sparse:     expected unsigned int [usertype] High
   drivers/message/fusion/mptlan.c:778:39: sparse:     got restricted __le32 [usertype]
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:785:9: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptlan.c:820:23: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] protocol @@     got unsigned short @@
   drivers/message/fusion/mptlan.c:820:23: sparse:     expected restricted __be16 [usertype] protocol
   drivers/message/fusion/mptlan.c:820:23: sparse:     got unsigned short
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32
   drivers/message/fusion/mptlan.c:924:23: sparse: sparse: cast to restricted __le32

vim +1177 drivers/message/fusion/mptlan.c

^1da177e4c3f41 Linus Torvalds      2005-04-16  1139  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1140  static void
c4028958b6ecad David Howells       2006-11-22  1141  mpt_lan_post_receive_buckets(struct mpt_lan_priv *priv)
^1da177e4c3f41 Linus Torvalds      2005-04-16  1142  {
c4028958b6ecad David Howells       2006-11-22  1143  	struct net_device *dev = priv->dev;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1144  	MPT_ADAPTER *mpt_dev = priv->mpt_dev;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1145  	MPT_FRAME_HDR *mf;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1146  	LANReceivePostRequest_t *pRecvReq;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1147  	SGETransaction32_t *pTrans;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1148  	SGESimple64_t *pSimple;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1149  	struct sk_buff *skb;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1150  	dma_addr_t dma;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1151  	u32 curr, buckets, count, max;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1152  	u32 len = (dev->mtu + dev->hard_header_len + 4);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1153  	unsigned long flags;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1154  	int i;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1155  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1156  	curr = atomic_read(&priv->buckets_out);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1157  	buckets = (priv->max_buckets_out - curr);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1158  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1159  	dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, Start_buckets = %u, buckets_out = %u\n",
^1da177e4c3f41 Linus Torvalds      2005-04-16  1160  			IOC_AND_NETDEV_NAMES_s_s(dev),
cadbd4a5e36dde Harvey Harrison     2008-07-03  1161  			__func__, buckets, curr));
^1da177e4c3f41 Linus Torvalds      2005-04-16  1162  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1163  	max = (mpt_dev->req_sz - MPT_LAN_RECEIVE_POST_REQUEST_SIZE) /
4e2e619f3c9e3c Gustavo A. R. Silva 2021-03-24  1164  			(sizeof(SGETransaction32_t) + sizeof(SGESimple64_t));
^1da177e4c3f41 Linus Torvalds      2005-04-16  1165  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1166  	while (buckets) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1167  		mf = mpt_get_msg_frame(LanCtx, mpt_dev);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1168  		if (mf == NULL) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1169  			printk (KERN_ERR "%s: Unable to alloc request frame\n",
cadbd4a5e36dde Harvey Harrison     2008-07-03  1170  				__func__);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1171  			dioprintk((KERN_ERR "%s: %u buckets remaining\n",
cadbd4a5e36dde Harvey Harrison     2008-07-03  1172  				 __func__, buckets));
^1da177e4c3f41 Linus Torvalds      2005-04-16  1173  			goto out;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1174  		}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1175  		pRecvReq = (LANReceivePostRequest_t *) mf;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1176  
e1fc2b5167f9c3 Eric Moore          2007-09-29 @1177  		i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
e1fc2b5167f9c3 Eric Moore          2007-09-29  1178  		mpt_dev->RequestNB[i] = 0;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1179  		count = buckets;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1180  		if (count > max)
^1da177e4c3f41 Linus Torvalds      2005-04-16  1181  			count = max;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1182  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1183  		pRecvReq->Function    = MPI_FUNCTION_LAN_RECEIVE;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1184  		pRecvReq->ChainOffset = 0;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1185  		pRecvReq->MsgFlags    = 0;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1186  		pRecvReq->PortNumber  = priv->pnum;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1187  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1188  		pTrans = (SGETransaction32_t *) pRecvReq->SG_List;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1189  		pSimple = NULL;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1190  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1191  		for (i = 0; i < count; i++) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1192  			int ctx;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1193  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1194  			spin_lock_irqsave(&priv->rxfidx_lock, flags);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1195  			if (priv->mpt_rxfidx_tail < 0) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1196  				printk (KERN_ERR "%s: Can't alloc context\n",
cadbd4a5e36dde Harvey Harrison     2008-07-03  1197  					__func__);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1198  				spin_unlock_irqrestore(&priv->rxfidx_lock,
^1da177e4c3f41 Linus Torvalds      2005-04-16  1199  						       flags);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1200  				break;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1201  			}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1202  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1203  			ctx = priv->mpt_rxfidx[priv->mpt_rxfidx_tail--];
^1da177e4c3f41 Linus Torvalds      2005-04-16  1204  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1205  			skb = priv->RcvCtl[ctx].skb;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1206  			if (skb && (priv->RcvCtl[ctx].len != len)) {
b114dda6f2f10c Christophe JAILLET  2022-01-06  1207  				dma_unmap_single(&mpt_dev->pcidev->dev,
^1da177e4c3f41 Linus Torvalds      2005-04-16  1208  						 priv->RcvCtl[ctx].dma,
^1da177e4c3f41 Linus Torvalds      2005-04-16  1209  						 priv->RcvCtl[ctx].len,
b114dda6f2f10c Christophe JAILLET  2022-01-06  1210  						 DMA_FROM_DEVICE);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1211  				dev_kfree_skb(priv->RcvCtl[ctx].skb);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1212  				skb = priv->RcvCtl[ctx].skb = NULL;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1213  			}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1214  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1215  			if (skb == NULL) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1216  				skb = dev_alloc_skb(len);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1217  				if (skb == NULL) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1218  					printk (KERN_WARNING
^1da177e4c3f41 Linus Torvalds      2005-04-16  1219  						MYNAM "/%s: Can't alloc skb\n",
cadbd4a5e36dde Harvey Harrison     2008-07-03  1220  						__func__);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1221  					priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1222  					spin_unlock_irqrestore(&priv->rxfidx_lock, flags);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1223  					break;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1224  				}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1225  
b114dda6f2f10c Christophe JAILLET  2022-01-06  1226  				dma = dma_map_single(&mpt_dev->pcidev->dev,
b114dda6f2f10c Christophe JAILLET  2022-01-06  1227  						     skb->data, len,
b114dda6f2f10c Christophe JAILLET  2022-01-06  1228  						     DMA_FROM_DEVICE);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1229  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1230  				priv->RcvCtl[ctx].skb = skb;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1231  				priv->RcvCtl[ctx].dma = dma;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1232  				priv->RcvCtl[ctx].len = len;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1233  			}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1234  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1235  			spin_unlock_irqrestore(&priv->rxfidx_lock, flags);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1236  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1237  			pTrans->ContextSize   = sizeof(u32);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1238  			pTrans->DetailsLength = 0;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1239  			pTrans->Flags         = 0;
4e2e619f3c9e3c Gustavo A. R. Silva 2021-03-24 @1240  			pTrans->TransactionContext = cpu_to_le32(ctx);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1241  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1242  			pSimple = (SGESimple64_t *) pTrans->TransactionDetails;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1243  
^1da177e4c3f41 Linus Torvalds      2005-04-16 @1244  			pSimple->FlagsLength = cpu_to_le32(
^1da177e4c3f41 Linus Torvalds      2005-04-16  1245  				((MPI_SGE_FLAGS_END_OF_BUFFER |
^1da177e4c3f41 Linus Torvalds      2005-04-16  1246  				  MPI_SGE_FLAGS_SIMPLE_ELEMENT |
^1da177e4c3f41 Linus Torvalds      2005-04-16  1247  				  MPI_SGE_FLAGS_64_BIT_ADDRESSING) << MPI_SGE_FLAGS_SHIFT) | len);
^1da177e4c3f41 Linus Torvalds      2005-04-16 @1248  			pSimple->Address.Low = cpu_to_le32((u32) priv->RcvCtl[ctx].dma);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1249  			if (sizeof(dma_addr_t) > sizeof(u32))
^1da177e4c3f41 Linus Torvalds      2005-04-16 @1250  				pSimple->Address.High = cpu_to_le32((u32) ((u64) priv->RcvCtl[ctx].dma >> 32));
^1da177e4c3f41 Linus Torvalds      2005-04-16  1251  			else
^1da177e4c3f41 Linus Torvalds      2005-04-16  1252  				pSimple->Address.High = 0;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1253  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1254  			pTrans = (SGETransaction32_t *) (pSimple + 1);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1255  		}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1256  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1257  		if (pSimple == NULL) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1258  /**/			printk (KERN_WARNING MYNAM "/%s: No buckets posted\n",
cadbd4a5e36dde Harvey Harrison     2008-07-03  1259  /**/				__func__);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1260  			mpt_free_msg_frame(mpt_dev, mf);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1261  			goto out;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1262  		}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1263  
^1da177e4c3f41 Linus Torvalds      2005-04-16 @1264  		pSimple->FlagsLength |= cpu_to_le32(MPI_SGE_FLAGS_END_OF_LIST << MPI_SGE_FLAGS_SHIFT);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1265  
^1da177e4c3f41 Linus Torvalds      2005-04-16 @1266  		pRecvReq->BucketCount = cpu_to_le32(i);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1267  

:::::: The code at line 1177 was first introduced by commit
:::::: e1fc2b5167f9c3614099e55d3f49763a26a5a339 [SCSI] mptlan: bug fix, only half the message frame is dma'd resulting in corruption

:::::: TO: Eric Moore <eric.moore@....com>
:::::: CC: James Bottomley <jejb@...grave.localdomain>

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

View attachment "config" of type "text/plain" (156670 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ