bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] BPF: replace no-need function call with saved value
@ 2023-04-07  6:48 zhongjun
  2023-04-07  7:03 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: zhongjun @ 2023-04-07  6:48 UTC (permalink / raw)
  To: bpf; +Cc: zhongjun

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(-)

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;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] BPF: replace no-need function call with saved value
  2023-04-07  6:48 [PATCH] BPF: replace no-need function call with saved value zhongjun
@ 2023-04-07  7:03 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2023-04-07  7:03 UTC (permalink / raw)
  To: zhongjun, Greg Kroah-Hartman; +Cc: bpf

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-07  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07  6:48 [PATCH] BPF: replace no-need function call with saved value zhongjun
2023-04-07  7:03 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).