diff mbox series

BPF: replace no-need function call with saved value

Message ID 20230407064837.32015-1-zhongjun@uniontech.com (mailing list archive)
State Rejected
Delegated to: BPF
Headers show
Series BPF: replace no-need function call with saved value | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

zhongjun@uniontech.com April 7, 2023, 6:48 a.m. UTC
From: zhongjun <zhongjun@uniontech.com>

The var 'is_priv' is already there, needn't call bpf_capable()
again.
Applying this patch, to refine the codes making it robust and optimal.

Signed-off-by: Jun Zhong <zhongjun@uniontech.com>
base-commit: 919e659ed12568b5b8ba6c2ffdd82d8d31fc28af
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexei Starovoitov April 7, 2023, 7:03 a.m. UTC | #1
On Thu, Apr 6, 2023 at 11:53 PM <zhongjun@uniontech.com> wrote:
>
> From: zhongjun <zhongjun@uniontech.com>
>
> The var 'is_priv' is already there, needn't call bpf_capable()
> again.
> Applying this patch, to refine the codes making it robust and optimal.
>
> Signed-off-by: Jun Zhong <zhongjun@uniontech.com>
> base-commit: 919e659ed12568b5b8ba6c2ffdd82d8d31fc28af

Please stop spamming us.
All of your patches are auto-rejected from now on.
diff mbox series

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index d517d13878cf..bee9f29155b0 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -17720,7 +17720,7 @@  int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr)
 	env->allow_uninit_stack = bpf_allow_uninit_stack();
 	env->bypass_spec_v1 = bpf_bypass_spec_v1();
 	env->bypass_spec_v4 = bpf_bypass_spec_v4();
-	env->bpf_capable = bpf_capable();
+	env->bpf_capable = is_priv;
 	env->rcu_tag_supported = btf_vmlinux &&
 		btf_find_by_name_kind(btf_vmlinux, "rcu", BTF_KIND_TYPE_TAG) > 0;