All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks
@ 2022-05-29 20:15 Daniel Xu
  2022-05-30  5:50 ` Song Liu
  2022-06-01 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Xu @ 2022-05-29 20:15 UTC (permalink / raw)
  To: bpf, ast, daniel, andrii; +Cc: Daniel Xu, linux-kernel

These checks were effectively noops b/c there's only one way these
functions get called: through prog_ops dispatching. And since there's no
other callers, we can be sure that `prog` is always the correct type.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 net/bpf/test_run.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 56f059b3c242..2ca96acbc50a 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -1420,9 +1420,6 @@ int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
 	void *data;
 	int ret;
 
-	if (prog->type != BPF_PROG_TYPE_FLOW_DISSECTOR)
-		return -EINVAL;
-
 	if (kattr->test.flags || kattr->test.cpu || kattr->test.batch_size)
 		return -EINVAL;
 
@@ -1487,9 +1484,6 @@ int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kat
 	u32 retval, duration;
 	int ret = -EINVAL;
 
-	if (prog->type != BPF_PROG_TYPE_SK_LOOKUP)
-		return -EINVAL;
-
 	if (kattr->test.flags || kattr->test.cpu || kattr->test.batch_size)
 		return -EINVAL;
 
-- 
2.36.1


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

* Re: [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks
  2022-05-29 20:15 [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks Daniel Xu
@ 2022-05-30  5:50 ` Song Liu
  2022-06-01 22:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2022-05-30  5:50 UTC (permalink / raw)
  To: Daniel Xu
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, open list

On Sun, May 29, 2022 at 1:16 PM Daniel Xu <dxu@dxuuu.xyz> wrote:
>
> These checks were effectively noops b/c there's only one way these
> functions get called: through prog_ops dispatching. And since there's no
> other callers, we can be sure that `prog` is always the correct type.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>

Acked-by: Song Liu <songliubraving@fb.com>

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

* Re: [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks
  2022-05-29 20:15 [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks Daniel Xu
  2022-05-30  5:50 ` Song Liu
@ 2022-06-01 22:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-01 22:50 UTC (permalink / raw)
  To: Daniel Xu; +Cc: bpf, ast, daniel, andrii, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Sun, 29 May 2022 15:15:41 -0500 you wrote:
> These checks were effectively noops b/c there's only one way these
> functions get called: through prog_ops dispatching. And since there's no
> other callers, we can be sure that `prog` is always the correct type.
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
>  net/bpf/test_run.c | 6 ------
>  1 file changed, 6 deletions(-)

Here is the summary with links:
  - [bpf-next] bpf, test_run: Remove unnecessary prog type checks
    https://git.kernel.org/bpf/bpf-next/c/330eb2a696f2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-06-01 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 20:15 [PATCH bpf-next] bpf, test_run: Remove unnecessary prog type checks Daniel Xu
2022-05-30  5:50 ` Song Liu
2022-06-01 22:50 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.