BPF List
 help / color / mirror / Atom feed
From: Wenli Xie <xwlpt@126.com>
To: martin.lau@linux.dev, ast@kernel.org, daniel@iogearbox.net,
	song@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wenli Xie <wlxie7296@gmail.com>
Subject: [PATCH] bpf: Get the program type by resolve_prog_type() directly
Date: Mon, 13 Nov 2023 03:18:12 +0000	[thread overview]
Message-ID: <20231113031812.3639430-1-xwlpt@126.com> (raw)

From: Wenli Xie <wlxie7296@gmail.com>

The bpf program type can be get by resolve_prog_type() directly.

Signed-off-by: Wenli Xie <wlxie7296@gmail.com>
---
 kernel/bpf/btf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 15d71d2986d3..b8ac96906bc5 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6963,7 +6963,7 @@ int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog,
 {
 	struct bpf_verifier_log *log = &env->log;
 	struct bpf_prog *prog = env->prog;
-	enum bpf_prog_type prog_type = prog->type;
+	enum bpf_prog_type prog_type = resolve_prog_type(env->prog);
 	struct btf *btf = prog->aux->btf;
 	const struct btf_param *args;
 	const struct btf_type *t, *ref_t;
@@ -7001,8 +7001,6 @@ int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog,
 		bpf_log(log, "Verifier bug in function %s()\n", tname);
 		return -EFAULT;
 	}
-	if (prog_type == BPF_PROG_TYPE_EXT)
-		prog_type = prog->aux->dst_prog->type;
 
 	t = btf_type_by_id(btf, t->type);
 	if (!t || !btf_type_is_func_proto(t)) {
-- 
2.34.1


             reply	other threads:[~2023-11-13  3:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13  3:18 Wenli Xie [this message]
2023-11-13 14:15 ` [PATCH] bpf: Get the program type by resolve_prog_type() directly Stanislav Fomichev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231113031812.3639430-1-xwlpt@126.com \
    --to=xwlpt@126.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --cc=wlxie7296@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox