netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: wenxu@ucloud.cn
Cc: kbuild-all@lists.01.org, pablo@netfilter.org, fw@strlen.de,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 2/5] netfilter: nft_tunnel: support NFT_TUNNEL_IPV4_SRC/DST match
Date: Sun, 27 Oct 2019 18:32:43 +0800	[thread overview]
Message-ID: <201910271840.MV2CnqwN%lkp@intel.com> (raw)
In-Reply-To: <1571913336-13431-3-git-send-email-wenxu@ucloud.cn>

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@intel.com>


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

  reply	other threads:[~2019-10-27 10:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 10:35 [PATCH nf-next 0/5] netfilter: nft_tunnel: support tunnel match expr offload wenxu
2019-10-24 10:35 ` [PATCH nf-next 1/5] netfilter: nft_tunnel: add nft_tunnel_mode_validate function wenxu
2019-11-15 22:52   ` Pablo Neira Ayuso
2019-10-24 10:35 ` [PATCH nf-next 2/5] netfilter: nft_tunnel: support NFT_TUNNEL_IPV4_SRC/DST match wenxu
2019-10-27 10:32   ` kbuild test robot [this message]
2019-10-24 10:35 ` [PATCH nf-next 3/5] netfilter: nft_tunnel: add inet type check in nft_tunnel_mode_validate wenxu
2019-11-15 22:55   ` Pablo Neira Ayuso
2019-10-24 10:35 ` [PATCH nf-next 4/5] netfilter: nft_tunnel: support NFT_TUNNEL_IPV6_SRC/DST match wenxu
2019-11-15 22:56   ` Pablo Neira Ayuso
2019-10-24 10:35 ` [PATCH nf-next 5/5] netfilter: nft_tunnel: add nft_tunnel_get_offload support wenxu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201910271840.MV2CnqwN%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=fw@strlen.de \
    --cc=kbuild-all@lists.01.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=wenxu@ucloud.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).