backport-libbpf-Fix-NULL-pointer-dereference-in_bpf_object__c.patch backport-libbpf-Fix-str_has_sfxs-return-value.patch backport-libbpf-Initialize-err-in-probe_map_create.patch (cherry picked from commit e55c477544ff210c205ad481d168cd7a30ad43ad)
36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
From 8663289b5199c67bc2bcf82a1ec91ef874df2813 Mon Sep 17 00:00:00 2001
|
|
From: Dan Carpenter <dan.carpenter@oracle.com>
|
|
Date: Tue, 19 Jul 2022 12:53:01 +0300
|
|
Subject: [PATCH] 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
|
|
---
|
|
src/libbpf_internal.h | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/libbpf_internal.h b/src/libbpf_internal.h
|
|
index f01dbab49..4135ae0a2 100644
|
|
--- a/src/libbpf_internal.h
|
|
+++ b/src/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.
|