[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200929060619.psnobg3cz3zbfx6u@kafai-mbp>
Date: Mon, 28 Sep 2020 23:06:19 -0700
From: Martin KaFai Lau <kafai@...com>
To: Lorenz Bauer <lmb@...udflare.com>
CC: Shuah Khan <shuah@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
<kernel-team@...udflare.com>, <linux-kselftest@...r.kernel.org>,
<netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 4/4] selftest: bpf: Test copying a sockmap
and sockhash
On Mon, Sep 28, 2020 at 10:08:05AM +0100, Lorenz Bauer wrote:
[ ... ]
> SEC("iter/sockmap")
> -int count_elems(struct bpf_iter__sockmap *ctx)
> +int copy(struct bpf_iter__sockmap *ctx)
> {
> struct sock *sk = ctx->sk;
> __u32 tmp, *key = ctx->key;
> int ret;
>
> - if (key)
> - elems++;
> + if (!key)
> + return 0;
>
> - if (sk)
> + elems++;
> +
> + /* We need a temporary buffer on the stack, since the verifier doesn't
> + * let us use the pointer from the context as an argument to the helper.
Is it something that can be improved later?
others LGTM.
Powered by blists - more mailing lists