drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:975:27: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Sun Jun 21 2020 - 06:34:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 64677779e8962c20b580b471790fe42367750599
commit: ccfc639a94f25eb8639e8ffbecad2f6b60d22eb1 net: stmmac: selftests: Add a selftest for Flexible RX Parser
date: 11 months ago
config: riscv-randconfig-s031-20200621 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-rc2-13-gc59158c8-dirty
git checkout ccfc639a94f25eb8639e8ffbecad2f6b60d22eb1
# save the attached .config to linux build tree
make W=1 C=1 ARCH=riscv CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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/stmicro/stmmac/stmmac_selftests.c:975:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] mask @@ got int @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:975:27: sparse: expected restricted __be32 [usertype] mask
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:975:27: sparse: got int

vim +975 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

916
917 #ifdef CONFIG_NET_CLS_ACT
918 static int stmmac_test_rxp(struct stmmac_priv *priv)
919 {
920 unsigned char addr[ETH_ALEN] = {0xde, 0xad, 0xbe, 0xef, 0x00, 0x00};
921 struct tc_cls_u32_offload cls_u32 = { };
922 struct stmmac_packet_attrs attr = { };
923 struct tc_action **actions, *act;
924 struct tc_u32_sel *sel;
925 struct tcf_exts *exts;
926 int ret, i, nk = 1;
927
928 if (!tc_can_offload(priv->dev))
929 return -EOPNOTSUPP;
930 if (!priv->dma_cap.frpsel)
931 return -EOPNOTSUPP;
932
933 sel = kzalloc(sizeof(*sel) + nk * sizeof(struct tc_u32_key), GFP_KERNEL);
934 if (!sel)
935 return -ENOMEM;
936
937 exts = kzalloc(sizeof(*exts), GFP_KERNEL);
938 if (!exts) {
939 ret = -ENOMEM;
940 goto cleanup_sel;
941 }
942
943 actions = kzalloc(nk * sizeof(*actions), GFP_KERNEL);
944 if (!actions) {
945 ret = -ENOMEM;
946 goto cleanup_exts;
947 }
948
949 act = kzalloc(nk * sizeof(*act), GFP_KERNEL);
950 if (!act) {
951 ret = -ENOMEM;
952 goto cleanup_actions;
953 }
954
955 cls_u32.command = TC_CLSU32_NEW_KNODE;
956 cls_u32.common.chain_index = 0;
957 cls_u32.common.protocol = htons(ETH_P_ALL);
958 cls_u32.knode.exts = exts;
959 cls_u32.knode.sel = sel;
960 cls_u32.knode.handle = 0x123;
961
962 exts->nr_actions = nk;
963 exts->actions = actions;
964 for (i = 0; i < nk; i++) {
965 struct tcf_gact *gact = to_gact(&act[i]);
966
967 actions[i] = &act[i];
968 gact->tcf_action = TC_ACT_SHOT;
969 }
970
971 sel->nkeys = nk;
972 sel->offshift = 0;
973 sel->keys[0].off = 6;
974 sel->keys[0].val = htonl(0xdeadbeef);
> 975 sel->keys[0].mask = ~0x0;
976
977 ret = stmmac_tc_setup_cls_u32(priv, priv, &cls_u32);
978 if (ret)
979 goto cleanup_act;
980
981 attr.dst = priv->dev->dev_addr;
982 attr.src = addr;
983
984 ret = __stmmac_test_loopback(priv, &attr);
985 ret = !ret; /* Shall NOT receive packet */
986
987 cls_u32.command = TC_CLSU32_DELETE_KNODE;
988 stmmac_tc_setup_cls_u32(priv, priv, &cls_u32);
989
990 cleanup_act:
991 kfree(act);
992 cleanup_actions:
993 kfree(actions);
994 cleanup_exts:
995 kfree(exts);
996 cleanup_sel:
997 kfree(sel);
998 return ret;
999 }
1000 #else
1001 static int stmmac_test_rxp(struct stmmac_priv *priv)
1002 {
1003 return -EOPNOTSUPP;
1004 }
1005 #endif
1006

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

Attachment: .config.gz
Description: application/gzip