Skip to contentSkip to conversation

bpf: Use E2BIG instead of ENOENT

PATCH In review Tao Chen 2 participants 3 messages Nov 4, 2023 – Nov 6, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Tao Chen

author
#0 lore raw

PATCH 1/1 bpf: Use E2BIG instead of ENOENT

Use E2BIG instead of ENOENT when the key size beyond the buckets size, it seems more meaningful.

---
 kernel/bpf/stackmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/stackmap.c +1 -1
index 458bb80b14d5..b78369bdec8d 100644
@@ -570,7 +570,7 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value)
 	u32 id = *(u32 *)key, trace_len;
 
 	if (unlikely(id >= smap->n_buckets))
-		return -ENOENT;
+		return -E2BIG;
 
 	bucket = xchg(&smap->buckets[id], NULL);
 	if (!bucket)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Tao Chen

Use E2BIG instead of ENOENT when the key size beyond the buckets size, it seems more meaningful.

seems more meaningful?
Sorry. That's hardly a reason to break someone's code.

A message that is not in the archive (sent off-list or not yet received): CA+92Ff+ZW5wu3mZFs--nxcyJyc7YxEhP-yuL-BEsWzVChR9Jdg@mail.gmail.com

author
#3 lore raw

Hi, Alexei, the delete element api of stackmap return E2BIG when the key size beyond the buckets size, so i try to keep the same approach. Maybe it's not necessary, anyway, thanks for your reply.

Quoted 17 lines · Tao Chen

---------- Forwarded message ---------
发件人: *Alexei Starovoitov* <[email protected] <mailto:[email protected]>>
Date: 2023年11月5日周日 04:54
Subject: Re: [PATCH] bpf: Use E2BIG instead of ENOENT
To: Tao Chen <[email protected] <mailto:[email protected]>>
Cc: Song Liu <[email protected] <mailto:[email protected]>>, Jiri Olsa <[email protected] <mailto:[email protected]>>, Alexei Starovoitov <[email protected] <mailto:[email protected]>>, Daniel Borkmann <[email protected] <mailto:[email protected]>>, Andrii Nakryiko <[email protected] <mailto:[email protected]>>, Yonghong Song <[email protected] <mailto:[email protected]>>, Martin KaFai Lau <[email protected] <mailto:[email protected]>>, John Fastabend <[email protected] <mailto:[email protected]>>, Hao Luo <[email protected] <mailto:[email protected]>>, bpf <[email protected] <mailto:[email protected]>>, LKML <[email protected] <mailto:[email protected]>>

Quoted 3 lines · On Fri, Nov 3, 2023 at 7:44 PM Tao Chen <[email protected]…

Use E2BIG instead of ENOENT when the key size beyond the buckets size, it seems more meaningful.

seems more meaningful?
Sorry. That's hardly a reason to break someone's code.