tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 61c3426aca2c71052ddcd06c32e29d92304990fd commit: c247897d7c194e6fb4a7c8314af2226bec017a59 [2619/4832] netfilter: nft_payload: access GRE payload via inner offset config: sparc-randconfig-s041-20221102 compiler: sparc-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/next/linux-next.git/commit/?id=c247897d7c194e6fb4a7c8314af2226bec017a59 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 c247897d7c194e6fb4a7c8314af2226bec017a59 # 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=sparc SHELL=/bin/bash net/netfilter/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) net/netfilter/nft_payload.c: note: in included file (through include/net/sctp/sctp.h, include/net/sctp/checksum.h): include/net/sctp/structs.h:335:41: sparse: sparse: array of flexible structures >> net/netfilter/nft_payload.c:112:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] version @@ got restricted __be16 @@ net/netfilter/nft_payload.c:112:25: sparse: expected unsigned int [usertype] version net/netfilter/nft_payload.c:112:25: sparse: got restricted __be16 >> net/netfilter/nft_payload.c:114:22: sparse: sparse: restricted __be16 degrades to integer vim +112 net/netfilter/nft_payload.c 82 83 static int __nft_payload_inner_offset(struct nft_pktinfo *pkt) 84 { 85 unsigned int thoff = nft_thoff(pkt); 86 87 if (!(pkt->flags & NFT_PKTINFO_L4PROTO) || pkt->fragoff) 88 return -1; 89 90 switch (pkt->tprot) { 91 case IPPROTO_UDP: 92 pkt->inneroff = thoff + sizeof(struct udphdr); 93 break; 94 case IPPROTO_TCP: { 95 struct tcphdr *th, _tcph; 96 97 th = skb_header_pointer(pkt->skb, thoff, sizeof(_tcph), &_tcph); 98 if (!th) 99 return -1; 100 101 pkt->inneroff = thoff + __tcp_hdrlen(th); 102 } 103 break; 104 case IPPROTO_GRE: { 105 u32 offset = sizeof(struct gre_base_hdr), version; 106 struct gre_base_hdr *gre, _gre; 107 108 gre = skb_header_pointer(pkt->skb, thoff, sizeof(_gre), &_gre); 109 if (!gre) 110 return -1; 111 > 112 version = gre->flags & GRE_VERSION; 113 switch (version) { > 114 case GRE_VERSION_0: 115 if (gre->flags & GRE_ROUTING) 116 return -1; 117 118 if (gre->flags & GRE_CSUM) { 119 offset += sizeof_field(struct gre_full_hdr, csum) + 120 sizeof_field(struct gre_full_hdr, reserved1); 121 } 122 if (gre->flags & GRE_KEY) 123 offset += sizeof_field(struct gre_full_hdr, key); 124 125 if (gre->flags & GRE_SEQ) 126 offset += sizeof_field(struct gre_full_hdr, seq); 127 break; 128 default: 129 return -1; 130 } 131 132 pkt->inneroff = thoff + offset; 133 } 134 break; 135 default: 136 return -1; 137 } 138 139 pkt->flags |= NFT_PKTINFO_INNER; 140 141 return 0; 142 } 143 -- 0-DAY CI Kernel Test Service https://01.org/lkp