]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: refactor bpf_test_run() to separate own failures and test program result
authorRoman Gushchin <guro@fb.com>
Sat, 1 Dec 2018 18:39:44 +0000 (10:39 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 1 Dec 2018 20:33:58 +0000 (12:33 -0800)
commitba1bbcc2aaab65a1c11b0ac743bbb485cd8cae26
tree0029074dcb0e8738360e4713f26158140419d34e
parent90e59d06e53c93a0a24c02aa9361af6d8963966d
bpf: refactor bpf_test_run() to separate own failures and test program result

After commit 39f852976aff ("bpf/test_run: support cgroup local
storage") the bpf_test_run() function may fail with -ENOMEM, if
it's not possible to allocate memory for a cgroup local storage.

This error shouldn't be mixed with the return value of the testing
program. Let's add an additional argument with a pointer where to
store the testing program's result; and make bpf_test_run()
return either 0 or -ENOMEM.

Fixes: 39f852976aff ("bpf/test_run: support cgroup local storage")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/bpf/test_run.c