lkml.org 
[lkml]   [2020]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2020-09-29 08:07    [W:0.062 / U:1.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site