Skip to content

Commit a943910

Browse files
committed
Test
Signed-off-by: Paul Chaignon <[email protected]>
1 parent 5bb43b8 commit a943910

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/testing/selftests/bpf/test_loader.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ static bool is_unpriv_capable_map(struct bpf_map *map)
913913
}
914914
}
915915

916-
static int do_prog_test_run(int fd_prog, int *retval, bool empty_opts, int linear_sz)
916+
static int do_prog_test_run(int fd_prog, int program_type, int *retval, bool empty_opts, int linear_sz)
917917
{
918918
__u8 tmp_out[TEST_DATA_LEN << 2] = {};
919919
__u8 tmp_in[TEST_DATA_LEN] = {};
@@ -927,6 +927,9 @@ static int do_prog_test_run(int fd_prog, int *retval, bool empty_opts, int linea
927927
.repeat = 1,
928928
);
929929

930+
if (program_type == BPF_PROG_TYPE_SCHED_CLS || program_type == BPF_PROG_TYPE_SCHED_ACT)
931+
linear_sz = topts.data_size_in - 1;
932+
930933
if (linear_sz) {
931934
ctx.data_end = linear_sz;
932935
topts.ctx_in = &ctx;
@@ -1181,7 +1184,7 @@ void run_subtest(struct test_loader *tester,
11811184
}
11821185
}
11831186

1184-
err = do_prog_test_run(bpf_program__fd(tprog), &retval,
1187+
err = do_prog_test_run(bpf_program__fd(tprog), bpf_program__type(tprog), &retval,
11851188
bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL ? true : false,
11861189
spec->linear_sz);
11871190
if (!err && retval != subspec->retval && subspec->retval != POINTER_VALUE) {

0 commit comments

Comments
 (0)