Re: [PATCH nf-next 2/5] netfilter: nft_tunnel: support NFT_TUNNEL_IPV4_SRC/DST match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/netfilter-nft_tunnel-support-tunnel-match-expr-offload/20191027-152013
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> net/netfilter/nft_tunnel.c:71:31: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] @@    got restrunsigned int [usertype] @@
>> net/netfilter/nft_tunnel.c:71:31: sparse:    expected unsigned int [usertype]
>> net/netfilter/nft_tunnel.c:71:31: sparse:    got restricted __be32 [usertype] src
   net/netfilter/nft_tunnel.c:81:31: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] @@    got restrunsigned int [usertype] @@
   net/netfilter/nft_tunnel.c:81:31: sparse:    expected unsigned int [usertype]
>> net/netfilter/nft_tunnel.c:81:31: sparse:    got restricted __be32 [usertype] dst
   net/netfilter/nft_tunnel.c:531:54: sparse: sparse: cast from restricted __be16
   net/netfilter/nft_tunnel.c:531:54: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned short [usertype] val @@    got resunsigned short [usertype] val @@
   net/netfilter/nft_tunnel.c:531:54: sparse:    expected unsigned short [usertype] val
   net/netfilter/nft_tunnel.c:531:54: sparse:    got restricted __be16 [usertype] tp_src
   net/netfilter/nft_tunnel.c:531:54: sparse: sparse: cast from restricted __be16
   net/netfilter/nft_tunnel.c:531:54: sparse: sparse: cast from restricted __be16
   net/netfilter/nft_tunnel.c:532:54: sparse: sparse: cast from restricted __be16
   net/netfilter/nft_tunnel.c:532:54: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned short [usertype] val @@    got resunsigned short [usertype] val @@
   net/netfilter/nft_tunnel.c:532:54: sparse:    expected unsigned short [usertype] val
   net/netfilter/nft_tunnel.c:532:54: sparse:    got restricted __be16 [usertype] tp_dst
   net/netfilter/nft_tunnel.c:532:54: sparse: sparse: cast from restricted __be16
   net/netfilter/nft_tunnel.c:532:54: sparse: sparse: cast from restricted __be16

vim +71 net/netfilter/nft_tunnel.c

    33	
    34	static void nft_tunnel_get_eval(const struct nft_expr *expr,
    35					struct nft_regs *regs,
    36					const struct nft_pktinfo *pkt)
    37	{
    38		const struct nft_tunnel *priv = nft_expr_priv(expr);
    39		u32 *dest = &regs->data[priv->dreg];
    40		struct ip_tunnel_info *tun_info;
    41	
    42		tun_info = skb_tunnel_info(pkt->skb);
    43	
    44		switch (priv->key) {
    45		case NFT_TUNNEL_PATH:
    46			if (!tun_info) {
    47				nft_reg_store8(dest, false);
    48				return;
    49			}
    50			if (nft_tunnel_mode_validate(priv->mode, tun_info->mode))
    51				nft_reg_store8(dest, true);
    52			else
    53				nft_reg_store8(dest, false);
    54			break;
    55		case NFT_TUNNEL_ID:
    56			if (!tun_info) {
    57				regs->verdict.code = NFT_BREAK;
    58				return;
    59			}
    60			if (nft_tunnel_mode_validate(priv->mode, tun_info->mode))
    61				*dest = ntohl(tunnel_id_to_key32(tun_info->key.tun_id));
    62			else
    63				regs->verdict.code = NFT_BREAK;
    64			break;
    65		case NFT_TUNNEL_IPV4_SRC:
    66			if (!tun_info) {
    67				regs->verdict.code = NFT_BREAK;
    68				return;
    69			}
    70			if (nft_tunnel_mode_validate(priv->mode, tun_info->mode))
  > 71				*dest = tun_info->key.u.ipv4.src;
    72			else
    73				regs->verdict.code = NFT_BREAK;
    74			break;
    75		case NFT_TUNNEL_IPV4_DST:
    76			if (!tun_info) {
    77				regs->verdict.code = NFT_BREAK;
    78				return;
    79			}
    80			if (nft_tunnel_mode_validate(priv->mode, tun_info->mode))
  > 81				*dest = tun_info->key.u.ipv4.dst;
    82			else
    83				regs->verdict.code = NFT_BREAK;
    84			break;
    85		default:
    86			WARN_ON(1);
    87			regs->verdict.code = NFT_BREAK;
    88		}
    89	}
    90	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux