diff mbox series

bpf: Use E2BIG instead of ENOENT

Message ID 20231104024444.385484-1-chen.dylane@gmail.com (mailing list archive)
State Rejected
Delegated to: BPF
Headers show
Series bpf: Use E2BIG instead of ENOENT | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-3 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-16 / veristat
bpf/vmtest-bpf-next-VM_Test-16 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-llvm-16 / build / build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-llvm-16 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-16 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-18 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-llvm-16 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-17 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-llvm-16 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-9 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for s390x-gcc / test (test_maps, false, 360) / test_maps on s390x with gcc
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1352 this patch: 1352
netdev/cc_maintainers warning 2 maintainers not CCed: kpsingh@kernel.org sdf@google.com
netdev/build_clang success Errors and warnings before: 1379 this patch: 1379
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1380 this patch: 1380
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tao Chen Nov. 4, 2023, 2:44 a.m. UTC
Use E2BIG instead of ENOENT when the key size beyond the buckets size,
it seems more meaningful.

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

Comments

Alexei Starovoitov Nov. 4, 2023, 8:54 p.m. UTC | #1
On Fri, Nov 3, 2023 at 7:44 PM Tao Chen <chen.dylane@gmail.com> wrote:
>
> 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.
Tao Chen Nov. 6, 2023, 4:13 p.m. UTC | #2
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.

在 2023/11/6 下午11:59, Tao Chen 写道:
> 
> 
> ---------- Forwarded message ---------
> 发件人: *Alexei Starovoitov* <alexei.starovoitov@gmail.com 
> <mailto:alexei.starovoitov@gmail.com>>
> Date: 2023年11月5日周日 04:54
> Subject: Re: [PATCH] bpf: Use E2BIG instead of ENOENT
> To: Tao Chen <chen.dylane@gmail.com <mailto:chen.dylane@gmail.com>>
> Cc: Song Liu <song@kernel.org <mailto:song@kernel.org>>, Jiri Olsa 
> <jolsa@kernel.org <mailto:jolsa@kernel.org>>, Alexei Starovoitov 
> <ast@kernel.org <mailto:ast@kernel.org>>, Daniel Borkmann 
> <daniel@iogearbox.net <mailto:daniel@iogearbox.net>>, Andrii Nakryiko 
> <andrii@kernel.org <mailto:andrii@kernel.org>>, Yonghong Song 
> <yonghong.song@linux.dev <mailto:yonghong.song@linux.dev>>, Martin KaFai 
> Lau <martin.lau@linux.dev <mailto:martin.lau@linux.dev>>, John Fastabend 
> <john.fastabend@gmail.com <mailto:john.fastabend@gmail.com>>, Hao Luo 
> <haoluo@google.com <mailto:haoluo@google.com>>, bpf <bpf@vger.kernel.org 
> <mailto:bpf@vger.kernel.org>>, LKML <linux-kernel@vger.kernel.org 
> <mailto:linux-kernel@vger.kernel.org>>
> 
> 
> On Fri, Nov 3, 2023 at 7:44 PM Tao Chen <chen.dylane@gmail.com 
> <mailto:chen.dylane@gmail.com>> wrote:
>  >
>  > 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.
diff mbox series

Patch

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)