diff options
author | Stanislav Fomichev <sdf@google.com> | 2019-01-07 20:46:46 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-01-08 00:15:55 +0300 |
commit | a8911d6d5878587767a78c6bde371298ca2a3be3 (patch) | |
tree | 85d622fbc4afb974a19887bc1dd2d92f3573816e /tools/testing/selftests/bpf/test_tcpnotify_user.c | |
parent | 97274b6126193cca2b820579f5d758589a2badc2 (diff) | |
download | linux-a8911d6d5878587767a78c6bde371298ca2a3be3.tar.xz |
selftests/bpf: fix incorrect users of create_and_get_cgroup
We have some tests that assume create_and_get_cgroup returns -1 on error
which is incorrect (it returns 0 on error). Since fd might be zero in
general case, change create_and_get_cgroup to return -1 on error
and fix the users that assume 0 on error.
Fixes: f269099a7e7a ("tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper")
Fixes: 7d2c6cfc5411 ("bpf: use --cgroup in test_suite if supplied")
v2:
- instead of fixing the uses that assume -1 on error, convert the users
that assume 0 on error (fd might be zero in general case)
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/test_tcpnotify_user.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_tcpnotify_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_user.c b/tools/testing/selftests/bpf/test_tcpnotify_user.c index ff3c4522aed6..4e4353711a86 100644 --- a/tools/testing/selftests/bpf/test_tcpnotify_user.c +++ b/tools/testing/selftests/bpf/test_tcpnotify_user.c @@ -115,7 +115,7 @@ int main(int argc, char **argv) goto err; cg_fd = create_and_get_cgroup(cg_path); - if (!cg_fd) + if (cg_fd < 0) goto err; if (join_cgroup(cg_path)) |