BPF List
 help / color / mirror / Atom feed
From: thinker.li@gmail.com
To: bpf@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
	song@kernel.org, kernel-team@meta.com, andrii@kernel.org
Cc: sinquersw@gmail.com, kuifeng@meta.com,
	Kui-Feng Lee <thinker.li@gmail.com>
Subject: [PATCH bpf-next v4 1/3] bpf, net: allow passing NULL prog to check_member.
Date: Tue, 20 Feb 2024 23:52:11 -0800	[thread overview]
Message-ID: <20240221075213.2071454-2-thinker.li@gmail.com> (raw)
In-Reply-To: <20240221075213.2071454-1-thinker.li@gmail.com>

From: Kui-Feng Lee <thinker.li@gmail.com>

To reuse the check_member function of the bpf_struct_ops structure for
checking if an operator is supported, we permit passing a NULL value for
the "prog" argument in check_member. The check_member function of the
bpf_struct_ops structure will be utilized for checking cfi_stubs in a
subsequent patch when registering a struct_ops type.

netdev@vger.kernel.org
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
 net/bpf/bpf_dummy_struct_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bpf/bpf_dummy_struct_ops.c b/net/bpf/bpf_dummy_struct_ops.c
index 02de71719aed..5fe5461d3173 100644
--- a/net/bpf/bpf_dummy_struct_ops.c
+++ b/net/bpf/bpf_dummy_struct_ops.c
@@ -178,7 +178,7 @@ static int bpf_dummy_ops_check_member(const struct btf_type *t,
 	case offsetof(struct bpf_dummy_ops, test_sleepable):
 		break;
 	default:
-		if (prog->aux->sleepable)
+		if (prog && prog->aux->sleepable)
 			return -EINVAL;
 	}
 
-- 
2.34.1


  reply	other threads:[~2024-02-21  7:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  7:52 [PATCH bpf-next v4 0/3] Check cfi_stubs before registering a struct_ops type thinker.li
2024-02-21  7:52 ` thinker.li [this message]
2024-02-21  7:52 ` [PATCH bpf-next v4 2/3] bpf: " thinker.li
2024-02-21 18:25   ` Martin KaFai Lau
2024-02-21 23:13     ` Kui-Feng Lee
2024-02-22  1:11       ` Kui-Feng Lee
2024-02-21  7:52 ` [PATCH bpf-next v4 3/3] selftests/bpf: Test case for lacking CFI stub functions thinker.li

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=20240221075213.2071454-2-thinker.li@gmail.com \
    --to=thinker.li@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuifeng@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=sinquersw@gmail.com \
    --cc=song@kernel.org \
    /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