netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jakub Sitnicki <jakub@cloudflare.com>, bpf@vger.kernel.org
Cc: kbuild-all@lists.01.org, netdev@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	kernel-team@cloudflare.com
Subject: Re: [PATCH bpf-next 1/2] bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide
Date: Tue, 8 Feb 2022 06:04:17 +0800	[thread overview]
Message-ID: <202202080631.n8UjqRXy-lkp@intel.com> (raw)
In-Reply-To: <20220207131459.504292-2-jakub@cloudflare.com>

Hi Jakub,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Jakub-Sitnicki/Split-bpf_sk_lookup-remote_port-field/20220207-215137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: sparc-randconfig-s031-20220207 (https://download.01.org/0day-ci/archive/20220208/202202080631.n8UjqRXy-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.2.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-dirty
        # https://github.com/0day-ci/linux/commit/b859a90e4c32a55e71d2731dd8dae96d7ad1defe
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jakub-Sitnicki/Split-bpf_sk_lookup-remote_port-field/20220207-215137
        git checkout b859a90e4c32a55e71d2731dd8dae96d7ad1defe
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc SHELL=/bin/bash net/bpf/

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 >>)
>> net/bpf/test_run.c:1149:55: sparse: sparse: restricted __be16 degrades to integer

vim +1149 net/bpf/test_run.c

7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1111  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1112  int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kattr,
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1113  				union bpf_attr __user *uattr)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1114  {
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1115  	struct bpf_test_timer t = { NO_PREEMPT };
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1116  	struct bpf_prog_array *progs = NULL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1117  	struct bpf_sk_lookup_kern ctx = {};
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1118  	u32 repeat = kattr->test.repeat;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1119  	struct bpf_sk_lookup *user_ctx;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1120  	u32 retval, duration;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1121  	int ret = -EINVAL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1122  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1123  	if (prog->type != BPF_PROG_TYPE_SK_LOOKUP)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1124  		return -EINVAL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1125  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1126  	if (kattr->test.flags || kattr->test.cpu)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1127  		return -EINVAL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1128  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1129  	if (kattr->test.data_in || kattr->test.data_size_in || kattr->test.data_out ||
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1130  	    kattr->test.data_size_out)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1131  		return -EINVAL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1132  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1133  	if (!repeat)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1134  		repeat = 1;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1135  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1136  	user_ctx = bpf_ctx_init(kattr, sizeof(*user_ctx));
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1137  	if (IS_ERR(user_ctx))
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1138  		return PTR_ERR(user_ctx);
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1139  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1140  	if (!user_ctx)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1141  		return -EINVAL;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1142  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1143  	if (user_ctx->sk)
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1144  		goto out;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1145  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1146  	if (!range_is_zero(user_ctx, offsetofend(typeof(*user_ctx), local_port), sizeof(*user_ctx)))
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1147  		goto out;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1148  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03 @1149  	if (user_ctx->local_port > U16_MAX || user_ctx->remote_port > U16_MAX) {
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1150  		ret = -ERANGE;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1151  		goto out;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1152  	}
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1153  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1154  	ctx.family = (u16)user_ctx->family;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1155  	ctx.protocol = (u16)user_ctx->protocol;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1156  	ctx.dport = (u16)user_ctx->local_port;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1157  	ctx.sport = (__force __be16)user_ctx->remote_port;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1158  
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1159  	switch (ctx.family) {
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1160  	case AF_INET:
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1161  		ctx.v4.daddr = (__force __be32)user_ctx->local_ip4;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1162  		ctx.v4.saddr = (__force __be32)user_ctx->remote_ip4;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1163  		break;
7c32e8f8bc33a5f Lorenz Bauer 2021-03-03  1164  

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

  parent reply	other threads:[~2022-02-07 22:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 13:14 [PATCH bpf-next 0/2] Split bpf_sk_lookup remote_port field Jakub Sitnicki
2022-02-07 13:14 ` [PATCH bpf-next 1/2] bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide Jakub Sitnicki
2022-02-07 19:14   ` Yonghong Song
2022-02-07 22:04   ` kernel test robot [this message]
2022-02-08 19:28     ` Alexei Starovoitov
2022-02-08 20:42       ` Jakub Sitnicki
2022-02-08 20:58         ` Alexei Starovoitov
2022-02-07 13:14 ` [PATCH bpf-next 2/2] selftests/bpf: Cover 4-byte load from remote_port in bpf_sk_lookup Jakub Sitnicki
2022-02-07 19:20   ` Yonghong Song

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=202202080631.n8UjqRXy-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kernel-team@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /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).