summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/verifier.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2023-04-07 01:41:56 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2023-04-11 18:05:43 +0200
commit8a6ca6bc553e3c878fa53c506bc6ec281efdc039 (patch)
tree909f38061d67bc33561cb8d80f850df7db2b2804 /kernel/bpf/verifier.c
parentbpf: Avoid incorrect -EFAULT error in BPF_LOG_KERNEL mode (diff)
downloadlinux-8a6ca6bc553e3c878fa53c506bc6ec281efdc039.tar.xz
linux-8a6ca6bc553e3c878fa53c506bc6ec281efdc039.zip
bpf: Simplify logging-related error conditions handling
Move log->level == 0 check into bpf_vlog_truncated() instead of doing it explicitly. Also remove unnecessary goto in kernel/bpf/verifier.c. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Lorenz Bauer <lmb@isovalent.com> Link: https://lore.kernel.org/bpf/20230406234205.323208-11-andrii@kernel.org
Diffstat (limited to '')
-rw-r--r--kernel/bpf/verifier.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 0323149803f5..a98cbc046d1e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -18861,12 +18861,10 @@ skip_full_check:
env->prog->aux->verified_insns = env->insn_processed;
bpf_vlog_finalize(log);
- if (log->level && bpf_vlog_truncated(log))
+ if (bpf_vlog_truncated(log))
ret = -ENOSPC;
- if (log->level && log->level != BPF_LOG_KERNEL && !log->ubuf) {
+ if (log->level && log->level != BPF_LOG_KERNEL && !log->ubuf)
ret = -EFAULT;
- goto err_release_maps;
- }
if (ret)
goto err_release_maps;