selftests/bpf: signedness bug in enable_all_controllers()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Jun 2019 07:00:21 +0000 (10:00 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 14 Jun 2019 23:14:07 +0000 (01:14 +0200)
The "len" variable needs to be signed for the error handling to work
properly.

Fixes: 596092ef8bea ("selftests/bpf: enable all available cgroup v2 controllers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/cgroup_helpers.c

index 0d89f0396be4c5690cb1ccbaf1564e3179ec2a8b..e95c33e333a40ad9c1c439e668c7a8c1d2000f8c 100644 (file)
@@ -47,7 +47,7 @@ int enable_all_controllers(char *cgroup_path)
        char buf[PATH_MAX];
        char *c, *c2;
        int fd, cfd;
-       size_t len;
+       ssize_t len;
 
        snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path);
        fd = open(path, O_RDONLY);