提交 14229b81 编写于 作者: D Dan Carpenter 提交者: Daniel Borkmann

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: a1c9d61b ("libbpf: Improve library identification for uprobe binary path resolution")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NMartin KaFai Lau <kafai@fb.com>
Cc: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/YtZ+/dAA195d99ak@kili
上级 c6018fc6
...@@ -108,9 +108,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx) ...@@ -108,9 +108,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx)
size_t str_len = strlen(str); size_t str_len = strlen(str);
size_t sfx_len = strlen(sfx); size_t sfx_len = strlen(sfx);
if (sfx_len <= str_len) if (sfx_len > str_len)
return strcmp(str + str_len - sfx_len, sfx);
return false; return false;
return strcmp(str + str_len - sfx_len, sfx) == 0;
} }
/* Symbol versioning is different between static and shared library. /* Symbol versioning is different between static and shared library.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册