diff options
author | Dan Carpenter | 2022-07-19 12:53:01 +0300 |
---|---|---|
committer | Daniel Borkmann | 2022-07-21 14:30:25 +0200 |
commit | 14229b8153a3ca51d97a22a18c68deeae64afce0 (patch) | |
tree | 52bce323f3f42e5cab42a79f9f3bff4dd78bde8b /tools/lib | |
parent | c6018fc6e7b6fcc4ac5430870c2e8b4ca556621a (diff) |
libbpf: Fix str_has_sfx()'s return value
The return from strcmp() is inverted so it wrongly returns true instead
of false and vice versa.
Fixes: a1c9d61b19cb ("libbpf: Improve library identification for uprobe binary path resolution")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Cc: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/YtZ+/dAA195d99ak@kili
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/libbpf_internal.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index f01dbab49da9..4135ae0a2bc3 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -108,9 +108,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx) size_t str_len = strlen(str); size_t sfx_len = strlen(sfx); - if (sfx_len <= str_len) - return strcmp(str + str_len - sfx_len, sfx); - return false; + if (sfx_len > str_len) + return false; + return strcmp(str + str_len - sfx_len, sfx) == 0; } /* Symbol versioning is different between static and shared library. |