drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
From: kernel test robot
Date: Tue Sep 01 2020 - 23:35:44 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b765a32a2e9170702467747e290614be072c4f76
commit: 088c5f0d1a7c7f01e668d9d2d75e7d93b43b7690 hinic: add generating mailbox random index support
date: 4 weeks ago
config: i386-randconfig-s001-20200902 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout 088c5f0d1a7c7f01e668d9d2d75e7d93b43b7690
# save the attached .config 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/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:570:21: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:648:54: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned char [usertype] * @@
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:648:54: sparse: expected void volatile [noderef] __iomem *addr
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:648:54: sparse: got unsigned char [usertype] *
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:671:58: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned char [usertype] * @@
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:671:58: sparse: expected void volatile [noderef] __iomem *addr
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:671:58: sparse: got unsigned char [usertype] *
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:723:22: sparse: sparse: cast to restricted __be64
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1164:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned char [usertype] *data @@ got void [noderef] __iomem * @@
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1164:25: sparse: expected unsigned char [usertype] *data
drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1164:25: sparse: got void [noderef] __iomem *
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=088c5f0d1a7c7f01e668d9d2d75e7d93b43b7690
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 088c5f0d1a7c7f01e668d9d2d75e7d93b43b7690
vim +570 drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c
541
542 static bool check_vf_mbox_random_id(struct hinic_mbox_func_to_func *func_to_func,
543 u8 *header)
544 {
545 struct hinic_hwdev *hwdev = func_to_func->hwdev;
546 struct hinic_mbox_work *mbox_work = NULL;
547 u64 mbox_header = *((u64 *)header);
548 u16 offset, src;
549 u32 random_id;
550 int vf_in_pf;
551
552 src = HINIC_MBOX_HEADER_GET(mbox_header, SRC_GLB_FUNC_IDX);
553
554 if (IS_PF_OR_PPF_SRC(src) || !func_to_func->support_vf_random)
555 return true;
556
557 if (!HINIC_IS_PPF(hwdev->hwif)) {
558 offset = hinic_glb_pf_vf_offset(hwdev->hwif);
559 vf_in_pf = src - offset;
560
561 if (vf_in_pf < 1 || vf_in_pf > hwdev->nic_cap.max_vf) {
562 dev_warn(&hwdev->hwif->pdev->dev,
563 "Receive vf id(0x%x) is invalid, vf id should be from 0x%x to 0x%x\n",
564 src, offset + 1,
565 hwdev->nic_cap.max_vf + offset);
566 return false;
567 }
568 }
569
> 570 random_id = be32_to_cpu(*(u32 *)(header + MBOX_SEG_LEN +
571 MBOX_HEADER_SZ));
572
573 if (random_id == func_to_func->vf_mbx_rand_id[src] ||
574 random_id == func_to_func->vf_mbx_old_rand_id[src])
575 return true;
576
577 dev_warn(&hwdev->hwif->pdev->dev,
578 "The mailbox random id(0x%x) of func_id(0x%x) doesn't match with pf reservation(0x%x)\n",
579 random_id, src, func_to_func->vf_mbx_rand_id[src]);
580
581 mbox_work = kzalloc(sizeof(*mbox_work), GFP_KERNEL);
582 if (!mbox_work)
583 return false;
584
585 mbox_work->func_to_func = func_to_func;
586 mbox_work->src_func_idx = src;
587
588 INIT_WORK(&mbox_work->work, update_random_id_work_handler);
589 queue_work(func_to_func->workq, &mbox_work->work);
590
591 return false;
592 }
593
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip