diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2020-02-19 18:10:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-19 13:10:07 -0500 |
commit | 1f345aac5e6fb342a3db326770c5576fad26d9d4 (patch) | |
tree | 5c1fcaefea4632f4fa5158128628d754d02e86e9 /libnetdata | |
parent | 420d972c18819c9b8cd56ec7b8ab7f5f897a3512 (diff) |
Ebpf coverity (#8135)
* Fix coverity errors on libnetdata/ebpf
* Fix coverity warnings inside ebpf collector
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/ebpf/ebpf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index 5cd8b5fcf7..6c49706893 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -62,9 +62,11 @@ int get_kernel_version() { if (fd < 0) return -1; - ssize_t len = read(fd, version, sizeof(version)); - if (len < 0) + ssize_t len = read(fd, ver, sizeof(ver)); + if (len < 0) { + close(fd); return -1; + } close(fd); @@ -79,6 +81,9 @@ int get_kernel_version() { if (*version) version++; + else + return -1; + move = patch; while (*version) *move++ = *version++; *move = '\0'; |