linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 6048/11059] drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:60:27: sparse: sparse: incorrect type in assignment (different base types)
@ 2021-04-09  7:36 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-04-09  7:36 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: kbuild-all, Linux Memory Management List, Pablo Neira Ayuso

[-- Attachment #1: Type: text/plain, Size: 5690 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6145d80cfc62e3ed8f16ff584d6287e6d88b82b9
commit: ba37b7caf1ed2395cc84d8f823ff933975f1f789 [6048/11059] net: ethernet: mtk_eth_soc: add support for initializing the PPE
config: arm64-randconfig-s032-20210409 (attached as .config)
compiler: aarch64-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-279-g6d5d9b42-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ba37b7caf1ed2395cc84d8f823ff933975f1f789
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout ba37b7caf1ed2395cc84d8f823ff933975f1f789
        # 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=arm64 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:60:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:60:27: sparse:     expected unsigned int
   drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:60:27: sparse:     got restricted __be32 [usertype]
>> drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:158:46: sparse: sparse: cast to restricted __be16

vim +60 drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c

    47	
    48	static void
    49	mtk_print_addr(struct seq_file *m, u32 *addr, bool ipv6)
    50	{
    51		u32 n_addr[4];
    52		int i;
    53	
    54		if (!ipv6) {
    55			seq_printf(m, "%pI4h", addr);
    56			return;
    57		}
    58	
    59		for (i = 0; i < ARRAY_SIZE(n_addr); i++)
  > 60			n_addr[i] = htonl(addr[i]);
    61		seq_printf(m, "%pI6", n_addr);
    62	}
    63	
    64	static void
    65	mtk_print_addr_info(struct seq_file *m, struct mtk_flow_addr_info *ai)
    66	{
    67		mtk_print_addr(m, ai->src, ai->ipv6);
    68		if (ai->src_port)
    69			seq_printf(m, ":%d", *ai->src_port);
    70		seq_printf(m, "->");
    71		mtk_print_addr(m, ai->dest, ai->ipv6);
    72		if (ai->dest_port)
    73			seq_printf(m, ":%d", *ai->dest_port);
    74	}
    75	
    76	static int
    77	mtk_ppe_debugfs_foe_show(struct seq_file *m, void *private, bool bind)
    78	{
    79		struct mtk_ppe *ppe = m->private;
    80		int i, count;
    81	
    82		for (i = 0, count = 0; i < MTK_PPE_ENTRIES; i++) {
    83			struct mtk_foe_entry *entry = &ppe->foe_table[i];
    84			struct mtk_foe_mac_info *l2;
    85			struct mtk_flow_addr_info ai = {};
    86			unsigned char h_source[ETH_ALEN];
    87			unsigned char h_dest[ETH_ALEN];
    88			int type, state;
    89			u32 ib2;
    90	
    91	
    92			state = FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1);
    93			if (!state)
    94				continue;
    95	
    96			if (bind && state != MTK_FOE_STATE_BIND)
    97				continue;
    98	
    99			type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1);
   100			seq_printf(m, "%05x %s %7s", i,
   101				   mtk_foe_entry_state_str(state),
   102				   mtk_foe_pkt_type_str(type));
   103	
   104			switch (type) {
   105			case MTK_PPE_PKT_TYPE_IPV4_HNAPT:
   106			case MTK_PPE_PKT_TYPE_IPV4_DSLITE:
   107				ai.src_port = &entry->ipv4.orig.src_port;
   108				ai.dest_port = &entry->ipv4.orig.dest_port;
   109				fallthrough;
   110			case MTK_PPE_PKT_TYPE_IPV4_ROUTE:
   111				ai.src = &entry->ipv4.orig.src_ip;
   112				ai.dest = &entry->ipv4.orig.dest_ip;
   113				break;
   114			case MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T:
   115				ai.src_port = &entry->ipv6.src_port;
   116				ai.dest_port = &entry->ipv6.dest_port;
   117				fallthrough;
   118			case MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T:
   119			case MTK_PPE_PKT_TYPE_IPV6_6RD:
   120				ai.src = &entry->ipv6.src_ip;
   121				ai.dest = &entry->ipv6.dest_ip;
   122				ai.ipv6 = true;
   123				break;
   124			}
   125	
   126			seq_printf(m, " orig=");
   127			mtk_print_addr_info(m, &ai);
   128	
   129			switch (type) {
   130			case MTK_PPE_PKT_TYPE_IPV4_HNAPT:
   131			case MTK_PPE_PKT_TYPE_IPV4_DSLITE:
   132				ai.src_port = &entry->ipv4.new.src_port;
   133				ai.dest_port = &entry->ipv4.new.dest_port;
   134				fallthrough;
   135			case MTK_PPE_PKT_TYPE_IPV4_ROUTE:
   136				ai.src = &entry->ipv4.new.src_ip;
   137				ai.dest = &entry->ipv4.new.dest_ip;
   138				seq_printf(m, " new=");
   139				mtk_print_addr_info(m, &ai);
   140				break;
   141			}
   142	
   143			if (type >= MTK_PPE_PKT_TYPE_IPV4_DSLITE) {
   144				l2 = &entry->ipv6.l2;
   145				ib2 = entry->ipv6.ib2;
   146			} else {
   147				l2 = &entry->ipv4.l2;
   148				ib2 = entry->ipv4.ib2;
   149			}
   150	
   151			*((__be32 *)h_source) = htonl(l2->src_mac_hi);
   152			*((__be16 *)&h_source[4]) = htons(l2->src_mac_lo);
   153			*((__be32 *)h_dest) = htonl(l2->dest_mac_hi);
   154			*((__be16 *)&h_dest[4]) = htons(l2->dest_mac_lo);
   155	
   156			seq_printf(m, " eth=%pM->%pM etype=%04x"
   157				      " vlan=%d,%d ib1=%08x ib2=%08x\n",
 > 158				   h_source, h_dest, ntohs(l2->etype),
   159				   l2->vlan1, l2->vlan2, entry->ib1, ib2);
   160		}
   161	
   162		return 0;
   163	}
   164	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41068 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  7:36 [linux-next:master 6048/11059] drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c:60:27: sparse: sparse: incorrect type in assignment (different base types) kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).