drivers/infiniband/hw/qedr/verbs.c:3760:59: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Thu Sep 17 2020 - 03:28:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5925fa68fe8244651b3f78a88c4af99190a88f0d
commit: acca72e2b031b9fbb4184511072bd246a0abcebc RDMA/qedr: SRQ's bug fixes
date: 9 weeks ago
config: sparc64-randconfig-s032-20200917 (attached as .config)
compiler: sparc64-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.2-201-g24bdaac6-dirty
git checkout acca72e2b031b9fbb4184511072bd246a0abcebc
# 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=sparc64

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/infiniband/hw/qedr/verbs.c:127:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be64 [usertype] sys_image_guid @@ got unsigned long long [usertype] sys_image_guid @@
drivers/infiniband/hw/qedr/verbs.c:127:30: sparse: expected restricted __be64 [usertype] sys_image_guid
drivers/infiniband/hw/qedr/verbs.c:127:30: sparse: got unsigned long long [usertype] sys_image_guid
drivers/infiniband/hw/qedr/verbs.c:994:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got unsigned short [usertype] icid @@
drivers/infiniband/hw/qedr/verbs.c:994:34: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:994:34: sparse: got unsigned short [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1347:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got int @@
drivers/infiniband/hw/qedr/verbs.c:1347:34: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1347:34: sparse: got int
drivers/infiniband/hw/qedr/verbs.c:1358:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got unsigned short [usertype] icid @@
drivers/infiniband/hw/qedr/verbs.c:1358:42: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1358:42: sparse: got unsigned short [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1866:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got unsigned short [usertype] icid @@
drivers/infiniband/hw/qedr/verbs.c:1866:34: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1866:34: sparse: got unsigned short [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1877:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got unsigned short [usertype] icid @@
drivers/infiniband/hw/qedr/verbs.c:1877:34: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1877:34: sparse: got unsigned short [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1880:41: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] icid @@ got unsigned short [usertype] icid @@
drivers/infiniband/hw/qedr/verbs.c:1880:41: sparse: expected restricted __le16 [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1880:41: sparse: got unsigned short [usertype] icid
drivers/infiniband/hw/qedr/verbs.c:1881:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] value @@ got unsigned long @@
drivers/infiniband/hw/qedr/verbs.c:1881:42: sparse: expected restricted __le16 [usertype] value
drivers/infiniband/hw/qedr/verbs.c:1881:42: sparse: got unsigned long
drivers/infiniband/hw/qedr/verbs.c:3149:22: sparse: sparse: cast from restricted __le64
drivers/infiniband/hw/qedr/verbs.c:3149:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] @@ got restricted __be64 [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3149:20: sparse: expected unsigned long long [usertype]
drivers/infiniband/hw/qedr/verbs.c:3149:20: sparse: got restricted __be64 [usertype]
drivers/infiniband/hw/qedr/verbs.c:3309:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] hi @@ got unsigned int [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3309:24: sparse: expected restricted __le32 [usertype] hi
drivers/infiniband/hw/qedr/verbs.c:3309:24: sparse: got unsigned int [usertype]
drivers/infiniband/hw/qedr/verbs.c:3310:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] lo @@ got unsigned int [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3310:24: sparse: expected restricted __le32 [usertype] lo
drivers/infiniband/hw/qedr/verbs.c:3310:24: sparse: got unsigned int [usertype]
drivers/infiniband/hw/qedr/verbs.c:3311:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] l_key @@ got unsigned int const [usertype] key @@
drivers/infiniband/hw/qedr/verbs.c:3311:22: sparse: expected restricted __le32 [usertype] l_key
drivers/infiniband/hw/qedr/verbs.c:3311:22: sparse: got unsigned int const [usertype] key
drivers/infiniband/hw/qedr/verbs.c:3330:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] length_lo @@ got unsigned long long [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3330:26: sparse: expected restricted __le32 [usertype] length_lo
drivers/infiniband/hw/qedr/verbs.c:3330:26: sparse: got unsigned long long [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3331:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] hi @@ got unsigned int [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3331:28: sparse: expected restricted __le32 [usertype] hi
drivers/infiniband/hw/qedr/verbs.c:3331:28: sparse: got unsigned int [usertype]
drivers/infiniband/hw/qedr/verbs.c:3332:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] lo @@ got unsigned int [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3332:28: sparse: expected restricted __le32 [usertype] lo
drivers/infiniband/hw/qedr/verbs.c:3332:28: sparse: got unsigned int [usertype]
drivers/infiniband/hw/qedr/verbs.c:3460:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3460:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3460:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3473:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3473:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3473:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3486:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3486:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3486:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __be32
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 const [usertype] imm_data @@
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: expected unsigned int [usertype] val
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: got restricted __be32 const [usertype] imm_data
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __be32
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __be32
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __be32
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __be32
drivers/infiniband/hw/qedr/verbs.c:3499:34: sparse: sparse: cast from restricted __le32
drivers/infiniband/hw/qedr/verbs.c:3499:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] imm_data @@ got restricted __be32 [usertype] @@
drivers/infiniband/hw/qedr/verbs.c:3499:32: sparse: expected restricted __le32 [usertype] imm_data
drivers/infiniband/hw/qedr/verbs.c:3499:32: sparse: got restricted __be32 [usertype]
drivers/infiniband/hw/qedr/verbs.c:3506:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3506:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3506:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3519:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3519:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3519:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3536:54: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bytes_len @@ got restricted __le32 [usertype] length @@
drivers/infiniband/hw/qedr/verbs.c:3536:54: sparse: expected unsigned int [usertype] bytes_len
drivers/infiniband/hw/qedr/verbs.c:3536:54: sparse: got restricted __le32 [usertype] length
drivers/infiniband/hw/qedr/verbs.c:3573:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] inv_l_key @@ got unsigned int const [usertype] invalidate_rkey @@
drivers/infiniband/hw/qedr/verbs.c:3573:33: sparse: expected restricted __le32 [usertype] inv_l_key
drivers/infiniband/hw/qedr/verbs.c:3573:33: sparse: got unsigned int const [usertype] invalidate_rkey
drivers/infiniband/hw/qedr/verbs.c:3655:42: sparse: sparse: restricted __le16 degrades to integer
>> drivers/infiniband/hw/qedr/verbs.c:3760:59: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] sge_prod @@ got unsigned int [usertype] sge_prod @@
>> drivers/infiniband/hw/qedr/verbs.c:3760:59: sparse: expected restricted __le32 [usertype] sge_prod
>> drivers/infiniband/hw/qedr/verbs.c:3760:59: sparse: got unsigned int [usertype] sge_prod
>> drivers/infiniband/hw/qedr/verbs.c:3763:59: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] wqe_prod @@ got unsigned int [usertype] wqe_prod @@
>> drivers/infiniband/hw/qedr/verbs.c:3763:59: sparse: expected restricted __le32 [usertype] wqe_prod
>> drivers/infiniband/hw/qedr/verbs.c:3763:59: sparse: got unsigned int [usertype] wqe_prod
drivers/infiniband/hw/qedr/verbs.c:3860:42: sparse: sparse: restricted __le16 degrades to integer
drivers/infiniband/hw/qedr/verbs.c:3889:43: sparse: sparse: cast from restricted __le32
drivers/infiniband/hw/qedr/verbs.c:3889:43: sparse: sparse: restricted __le32 degrades to integer
drivers/infiniband/hw/qedr/verbs.c:3985:68: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected unsigned short [usertype] hw_cons @@ got restricted __le16 [usertype] sq_cons @@
drivers/infiniband/hw/qedr/verbs.c:3985:68: sparse: expected unsigned short [usertype] hw_cons
drivers/infiniband/hw/qedr/verbs.c:3985:68: sparse: got restricted __le16 [usertype] sq_cons
drivers/infiniband/hw/qedr/verbs.c:3993:68: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected unsigned short [usertype] hw_cons @@ got restricted __le16 [usertype] sq_cons @@
drivers/infiniband/hw/qedr/verbs.c:3993:68: sparse: expected unsigned short [usertype] hw_cons
drivers/infiniband/hw/qedr/verbs.c:3993:68: sparse: got restricted __le16 [usertype] sq_cons
drivers/infiniband/hw/qedr/verbs.c:4000:38: sparse: sparse: restricted __le16 degrades to integer
drivers/infiniband/hw/qedr/verbs.c:4073:67: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected unsigned short [usertype] hw_cons @@ got restricted __le16 [usertype] sq_cons @@
drivers/infiniband/hw/qedr/verbs.c:4073:67: sparse: expected unsigned short [usertype] hw_cons
drivers/infiniband/hw/qedr/verbs.c:4073:67: sparse: got restricted __le16 [usertype] sq_cons
drivers/infiniband/hw/qedr/verbs.c:4258:46: sparse: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned short [usertype] hw_cons @@ got restricted __le16 [usertype] rq_cons_or_srq_id @@
drivers/infiniband/hw/qedr/verbs.c:4258:46: sparse: expected unsigned short [usertype] hw_cons
drivers/infiniband/hw/qedr/verbs.c:4258:46: sparse: got restricted __le16 [usertype] rq_cons_or_srq_id
drivers/infiniband/hw/qedr/verbs.c:1166:45: sparse: sparse: cast to restricted __be32
drivers/infiniband/hw/qedr/verbs.c:1167:45: sparse: sparse: cast to restricted __be32
drivers/infiniband/hw/qedr/verbs.c:4120:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] imm_data @@ got unsigned int @@
drivers/infiniband/hw/qedr/verbs.c:4120:33: sparse: expected restricted __be32 [usertype] imm_data
drivers/infiniband/hw/qedr/verbs.c:4120:33: sparse: got unsigned int

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=acca72e2b031b9fbb4184511072bd246a0abcebc
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout acca72e2b031b9fbb4184511072bd246a0abcebc
vim +3760 drivers/infiniband/hw/qedr/verbs.c

3693
3694 int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
3695 const struct ib_recv_wr **bad_wr)
3696 {
3697 struct qedr_srq *srq = get_qedr_srq(ibsrq);
3698 struct qedr_srq_hwq_info *hw_srq;
3699 struct qedr_dev *dev = srq->dev;
3700 struct qed_chain *pbl;
3701 unsigned long flags;
3702 int status = 0;
3703 u32 num_sge;
3704
3705 spin_lock_irqsave(&srq->lock, flags);
3706
3707 hw_srq = &srq->hw_srq;
3708 pbl = &srq->hw_srq.pbl;
3709 while (wr) {
3710 struct rdma_srq_wqe_header *hdr;
3711 int i;
3712
3713 if (!qedr_srq_elem_left(hw_srq) ||
3714 wr->num_sge > srq->hw_srq.max_sges) {
3715 DP_ERR(dev, "Can't post WR (%d,%d) || (%d > %d)\n",
3716 hw_srq->wr_prod_cnt,
3717 atomic_read(&hw_srq->wr_cons_cnt),
3718 wr->num_sge, srq->hw_srq.max_sges);
3719 status = -ENOMEM;
3720 *bad_wr = wr;
3721 break;
3722 }
3723
3724 hdr = qed_chain_produce(pbl);
3725 num_sge = wr->num_sge;
3726 /* Set number of sge and work request id in header */
3727 SRQ_HDR_SET(hdr, wr->wr_id, num_sge);
3728
3729 srq->hw_srq.wr_prod_cnt++;
3730 hw_srq->wqe_prod++;
3731 hw_srq->sge_prod++;
3732
3733 DP_DEBUG(dev, QEDR_MSG_SRQ,
3734 "SRQ WR: SGEs: %d with wr_id[%d] = %llx\n",
3735 wr->num_sge, hw_srq->wqe_prod, wr->wr_id);
3736
3737 for (i = 0; i < wr->num_sge; i++) {
3738 struct rdma_srq_sge *srq_sge = qed_chain_produce(pbl);
3739
3740 /* Set SGE length, lkey and address */
3741 SRQ_SGE_SET(srq_sge, wr->sg_list[i].addr,
3742 wr->sg_list[i].length, wr->sg_list[i].lkey);
3743
3744 DP_DEBUG(dev, QEDR_MSG_SRQ,
3745 "[%d]: len %d key %x addr %x:%x\n",
3746 i, srq_sge->length, srq_sge->l_key,
3747 srq_sge->addr.hi, srq_sge->addr.lo);
3748 hw_srq->sge_prod++;
3749 }
3750
3751 /* Update WQE and SGE information before
3752 * updating producer.
3753 */
3754 dma_wmb();
3755
3756 /* SRQ producer is 8 bytes. Need to update SGE producer index
3757 * in first 4 bytes and need to update WQE producer in
3758 * next 4 bytes.
3759 */
> 3760 srq->hw_srq.virt_prod_pair_addr->sge_prod = hw_srq->sge_prod;
3761 /* Make sure sge producer is updated first */
3762 dma_wmb();
> 3763 srq->hw_srq.virt_prod_pair_addr->wqe_prod = hw_srq->wqe_prod;
3764
3765 wr = wr->next;
3766 }
3767
3768 DP_DEBUG(dev, QEDR_MSG_SRQ, "POST: Elements in S-RQ: %d\n",
3769 qed_chain_get_elem_left(pbl));
3770 spin_unlock_irqrestore(&srq->lock, flags);
3771
3772 return status;
3773 }
3774

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

Attachment: .config.gz
Description: application/gzip