From: Yonghong Song <yonghong.song@linux.dev>
To: Florian Lehner <dev@der-flo.net>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, jolsa@kernel.org
Subject: Re: [PATCH bpf-next] bpf: Return EINVAL instead of NULL for map_lookup_elem of queue
Date: Sun, 9 Jun 2024 22:32:05 -0700 [thread overview]
Message-ID: <83728982-d976-4b5b-b8cb-531ca61dba5a@linux.dev> (raw)
In-Reply-To: <20240608092912.11615-1-dev@der-flo.net>
On 6/8/24 2:29 AM, Florian Lehner wrote:
> Programs should use map_peek_elem over map_lookup_elem for queues. NULL is
> also not a valid queue return nor a proper error, that could be handled.
>
> Signed-off-by: Florian Lehner <dev@der-flo.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> kernel/bpf/queue_stack_maps.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/queue_stack_maps.c b/kernel/bpf/queue_stack_maps.c
> index d869f51ea93a..85bead55024d 100644
> --- a/kernel/bpf/queue_stack_maps.c
> +++ b/kernel/bpf/queue_stack_maps.c
> @@ -234,7 +234,8 @@ static long queue_stack_map_push_elem(struct bpf_map *map, void *value,
> /* Called from syscall or from eBPF program */
> static void *queue_stack_map_lookup_elem(struct bpf_map *map, void *key)
> {
> - return NULL;
> + /* The eBPF program should use map_peek_elem instead */
> + return ERR_PTR(-EINVAL);
> }
>
> /* Called from syscall or from eBPF program */
next prev parent reply other threads:[~2024-06-10 5:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 9:29 [PATCH bpf-next] bpf: Return EINVAL instead of NULL for map_lookup_elem of queue Florian Lehner
2024-06-10 5:32 ` Yonghong Song [this message]
2024-06-11 19:14 ` Alexei Starovoitov
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=83728982-d976-4b5b-b8cb-531ca61dba5a@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dev@der-flo.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@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