Skip to content

Commit 735a328

Browse files
danobianakryiko
authored andcommitted
bpf, test_run: Remove unnecessary prog type checks
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> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/0a9aaac329f76ddb17df1786b001117823ffefa5.1653855302.git.dxu@dxuuu.xyz
1 parent 58a9559 commit 735a328

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

net/bpf/test_run.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,9 +1420,6 @@ int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
14201420
void *data;
14211421
int ret;
14221422

1423-
if (prog->type != BPF_PROG_TYPE_FLOW_DISSECTOR)
1424-
return -EINVAL;
1425-
14261423
if (kattr->test.flags || kattr->test.cpu || kattr->test.batch_size)
14271424
return -EINVAL;
14281425

@@ -1487,9 +1484,6 @@ int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kat
14871484
u32 retval, duration;
14881485
int ret = -EINVAL;
14891486

1490-
if (prog->type != BPF_PROG_TYPE_SK_LOOKUP)
1491-
return -EINVAL;
1492-
14931487
if (kattr->test.flags || kattr->test.cpu || kattr->test.batch_size)
14941488
return -EINVAL;
14951489

0 commit comments

Comments
 (0)