[PATCH] bpf: Use E2BIG instead of ENOENT

From: Tao Chen
Date: Fri Nov 03 2023 - 22:44:58 EST


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

Signed-off-by: Tao Chen <chen.dylane@xxxxxxxxx>
---
kernel/bpf/stackmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 458bb80b14d5..b78369bdec8d 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -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)
--
2.34.1